Aniket Vast

Change is the only inevitable constant.
Here's to everything that changes (for the better).
Politics to Sprituality, Technology to Work and Family to Life

Wednesday, July 3, 2019

Basic: Lightning Web Components Tips & Tricks



Settings, tips and tricks for the everyday Lightning Web Component (LWC) development folks. This article is for developers and programmers at heart, context isn't necessary, so lets get right to it ..

  1. I like to import everything at the top of the js file with this line
    import { LightningElement, track, api, wire } from'lwc' 
  2. The recordId property decorated with @api automatically receives the current record id OR needs to be passed by the parent component when it calls the child component in html with the attribute record-id={obj.value}, where obj.value is either a hardcoded-id or retrieve via JS controller or passed by it's parent.
  3. Import a getRecord adapter that allows to use the Lightning Data Service (LDS) to retrieve records without having to write Apex.
    import { getRecord } from 'lightning/uiRecordApi';
  4. Once imported use the @wire decorator to retrieve data
    @wire(getRecord, {recordId:'$userId',fields: [ 'User.Name''User.ContactId''User.Email' ] } )user;
  5. More to come.

Thursday, March 21, 2019

Linode not connecting after upgrade/maintenance

Fellow Linoders,

Just in case you notice that you cannot connect to ssh or ping your beloved node after maintenance or upgrade, make sure you have the 'Auto-Configure Networking' option set to enabled in your node's configuration profile, which is available from

Node > Settings > Advanced Configurations > Configuration section for your node label's Edit Menu > Scroll down on the right pane.


This will load the last known (and hopefully working) networking configs back on after a reboot. After you enable this, simply reboot the node.

This is the safest and easiest way to get back into your node. For more details follow detailed documentation here.

Thursday, January 26, 2017

Salesforce Hacks

1. If you have enabled 'Inline Editing' on list views and have enabled 'Enhanced List Views', but are still not able to get your list views to be inline editable, thats because editable list views can operate only on records based on a single record type at a time. So add a filter for 'Record Type' and select one record type name or blank (if thats what you want). List view should now be editable.

2. List views don't support mass delete, but enhanced list views do support mass update. Select multiple records from the check box on the left, double click on a field to change, notice a popup which asks, whether to apply the change to the selected records ? Batch mode !
If any record errors out (due to validation rule for example) then the rest still get committed. Super Cool !

Wednesday, September 21, 2016

Salesforce SOQL Length function

A typical scenario that I come across for using SOQL functions is for identifying certain type of ExternalIds.
In brief, what happens for large systems over a period of years OR through Mergers & Acquisitions is that, a single identifier field is leveraged to indicate data from multiple systems. Depending on the type of data in this one field, for example, if having 4 digits, means data from system A whereas 12 alphanumeric means data from system B and 8 digits means a link to system C of another division.

Post Salesforce implementation, such fields are stored/referred in Salesforce (via data migration) as externalId fields for identifying data from external systems. However the need to run a few integrations or batch jobs or just perform some legacy system match doesn't perish and sometimes we need to filter rows in SOQL depending on the length of characters in that externalId field.

Since there isn't any inbuilt Length() function, we can make use of the following SOQL
Select externalId from sObject where externalId like '____'
Note: Those are underscores and the number of underscores is the number of characters or the Length that you need.

Select externalId from sObject where (not externalId like '_____________')

Friday, August 5, 2016

Saturday, June 11, 2016

Experiment More

Get out of your comfort zone, become a fearless experimenter, you will find opportunities that would otherwise never occur to you. #Enterprenuers #Leaders #Experimenters

Future workforce crisis

Human Resources Expert Rainer Strack talks on The workforce crisis of 2030 and how to start solving it now. Staffing companies today should put in measures and systems in place to be ready for this future. We are getting ready .. are you ?


 


 

Sunday, May 29, 2016

Develop & Test Future methods

Implementing @future methods is a good way to get around DDL operation limits and constraints in Salesforce. Methods can be called asynchronously by adding the annotation @future. Salesforce platform framework handles all the queueing and calling when resources are available. Most of the times the calls are made almost immediately (Safe Harbour) post the current transaction context. However a small challenge arises for writing test classes for such methods. Since the call is by-design asynchronous. A simple work around is to wrap the future method call between Test.startTest() and Test.stopTest() methods. All asynchronous calls made after the startTest method are collected by the system. When stopTest is executed, all asynchronous processes are run synchronously.
Test.startTest();
classObj.callFutureMethod();
Test.stopTest();

Passing variables to future methods could be a bit complicated if you are used to passing sObjects (or their collections). Since future methods are going to run out of the current context, pass a collection of Ids instead and perform a SOQL to retrieve those objects later. If multiple parameters are required in an object structure, use a serializable object with JSON.
public AddressFuture () 
{
  List addresses = new List();
  AddressHelper ah1 = new AddressHelper('1 here st', 'San Francisco', 'CA', '94105');
  AddressHelper ah2 = new AddressHelper('2 here st', 'San Francisco', 'CA', '94105');
  AddressHelper ah3 = new AddressHelper('3 here st', 'San Francisco', 'CA', '94105');

  //serialize my objects
  addresses.add(JSON.serialize(ah3));
  addresses.add(JSON.serialize(ah2));
  addresses.add(JSON.serialize(ah3));

  doFutureCall(addresses);

}
@future
static void doFutureCall(List addressesSer) 
{

  AddressHelper currAddress = null;
  for (String ser : addressesSer)
  {
     currAddress = (AddressHelper) JSON.deserialize(ser, AddressHelper.class);
     System.debug('Deserialized in future:'+currAddress.street);
 }
}
A recursive problem that can occur with improper usage of future methods (and how to avoid it) is explained below in Jeff Douglas's blog. Check the link Prevent Future Recursion below.

References:
Salesforce Doc 1
Salesforce Doc 2
Prevent Future Recursion
Best Practice 1

 Aniket Vast

Saturday, May 21, 2016

Sweet Weekend

Every once in a while it's so good to throw away that namesake diet, enjoy the weekend being a kid with our kids and eating what they adore the most.
Sweet buttery soul satisfying stuff loaded with calories.

Forget that it's going to be Monday soon, it's going to rain meetings and issues, which neither the weekend nor our kids care about. And many times not even the folks in those meetings .. Why do we fail to show the 'don't care' attitude where we really need the most.
Ever wondered how many flavours does sweet have ? No it's not just one .. Not just sugar .. I found out today that one of the best ones is called 'Old Fashioned'. I guess it's by only becoming a kid we can appreciate the magic that maple syrup and pancakes can create.

After all, in today's world being happy and satisfied at the same time is a magical feeling.
 

Tuesday, May 13, 2014

Social Studio by Salesforce

Social Studio by Salesforce coming to a screen in front of you  ... anytime anywhere. social-studio

Salesforce combines its previous acquisitions (Buddy Media and Radian 6) into a new product altogether. Led by the CEO's of the original companies and strategically driven to integrate social listening, marketing and support into the exact target marketing cloud.

However strange it sounds, what I like about this is the organic innovation that resulted from the inorganic growth (acquisitions) that Salesforce went through. This should be an example of well orchestrated leadership from Salesforce executives, a trait that is fast becoming uncommon these days with the acquire as investment methodologies of IBM and Oracle.

"Our customers are looking at the innovation we continue to do as if we’re still a startup" - Lazerow@Salesforce.
Powered by Blogger.