Posts

Showing posts from September, 2021

Salesforce Fact #198 | LWC variable naming restriction

Image
We cannot declare an @api variable with the name starting with data in LWC as those are considered to be reserved attributes. However, it is not an error in case of @track. Attached are the screenshots.

Salesforce Fact #197 | Tweak with comma in list view filter

Image
Just like report filters, Comma in list view filter value is not treated as a part of text, instead it is considered as an OR condition. For example, if you have a list view filter on Account which considers the accounts with account number as 123,45. So if you simply write 123,45 in the filter condition it will return all the accounts whose account number is either 123 or 45. To specify the comma as part of the text, we need to enclose the filter value inside double quotes("). It will work correctly then. Attached are the screenshots.

Salesforce Fact #196 | Parent record field value using LDS in LWC

Image
We can use Lightning Data Service in LWC to get the field value from parent record. In this example, we are getting the contact name and the corresponding account name using LDS. Attached are the screenshots.  

Salesforce Fact #195 | Update role of single or multiple users from flow

Image
Suppose we would like to have an automation to assign specific role to single or multiple users. Again screen flow to the rescue. We can have a screen flow to select the users and then select the role and finally can update the user records with the new role. We can make use of the decision, assignment, loop and update records elements to achieve this. For parsing the value from the selected users, we can use a reusable subflow. Attached are the screenshots.  

Salesforce Fact #194 | Safe navigation in if-else condition

Image
Do you know we can use safe navigation operator in if-else check. Suppose, we have to check whether a list is not NULL and also it is non-empty. So generally we would first check if it is NULL and then would check with the isEmpty() function. But using safe navigation operator, we can cover both the condition check in a single expression. The results would remain the same in both the cases. Attached are the screenshots.

Salesforce Fact #193 | Set expiration date for permission set from flow

Image
Suppose we have a use case where we need to set the expiration date for a particular permission set i.e. all the users who are assigned the permission set won't have the access after that specified time. We can do it quickly using screen flow. Note: here the time in flow is according to my time zone i.e IST so in the query result screenshot it is 5 hours 30 mins earlier. Attached are the screenshots.

Salesforce Fact #192 | Call batch apex from flow

Image
Generally apex batch jobs are scheduled to run at particular time intervals. But suppose we have a use case where we need to run the batch job on adhoc basis. We can call the batch apex from a screen flow in that case and the screen flow can be invoked from a button. So, the batch job can be executed on demand. Attached are the screenshots.

Salesforce Fact #191 | Parse multi selected values in flow

Image
In many use cases, we use multi select picklist or checkbox group and once the values are selected, we need to parse and use them as per our requirement. The multi selected values are separated by semicolon. We can parse the string to get the individual values using decision, assignment, formula elements. In this example, we are selecting multiple users and then populating the individual values in a collection. Attached are the screenshots.

Salesforce Fact #190 | Freeze/unfreeze user from flow

Image
We can create a screen flow to choose user and freeze or unfreeze them accordingly. The elements would include picklist choice set, record choice set, decision, assignment, update records. To reduce the user result set, we can also fetch users based on the letter the name is starting with. Attached are the screenshots.