Posts

Salesforce Fact #928 | Default minimum enqueue delay

Do you know there is an org-wide setting to specify the default minimum delay for the enqueue jobs which do not have a delay parameter. From Setup -> Apex settings, we can go to the setting and put a value between 1 and 600 seconds i.e. 10 minutes maximum. This is not applicable to jobs enqueued using System.enqueue(queueable, delay) method. Reference:  https://help.salesforce.com/s/articleView?id=release-notes.rn_apex_orgWide_delayQueueable.htm&release=242&type=5

Salesforce Fact #927 | Overwrite apex code in developer console

Image
Have you seen this popup while saving an apex class? This is encountered when the apex class has already been saved from some other dev tool like vs code and you are overwriting those changes from the dev console. So, this popup works like a reminder before proceeding.

Salesforce Fact #926 | Close custom action popup in dispatcher console

In order to close the custom action modal from vf page in field service dispatcher console, we need to use parent.postMessage('closeLightbox','*'). Reference:  https://developer.salesforce.com/docs/atlas.en-us.field_service_dev.meta/field_service_dev/fsl_dev_code_samples_dispatcher.htm

Salesforce Fact #925 | Adding case team to case using apex

How to add predefined case team to a case using apex? We need to use CaseTeamTemplateRecord. Sample code: CaseTeamTemplateRecord rec = new CaseTeamTemplateRecord(); rec.ParentId = '500IS000009iUe7YAE'; // id of the case record rec.TeamTemplateId = '0B46F000000XZoMSAW'; // id of the caseteamtemplate, can be fetched from CaseTeamTemplate object insert rec; Reference:  https://developer.salesforce.com/docs/atlas.en-us.208.0.object_reference.meta/object_reference/sforce_api_objects_caseteamtemplaterecord.htm

Salesforce Fact #924 | Updating multi select lookup using screen action

Image
Suppose we have a datatable and multiselect lookup in screen flow. Now, whatever records are selected in the datatable should get selected in the lookup component. For this, we can make use of screen action. We can create a subflow which would take the list of selected records and extract the ids using a transform element and return those to the main flow. The returned ids can be selected as the input of the lookup. This would work instantly. In this example, we have an account lookup which is updated with the selected records of the datatable. Attached are the screenshots.

Salesforce Fact #923 | Find out matching leads/contacts using screen action

Image
Another use case using Screen flow action(Beta). We can have a screen flow to take email Id as input and find out what all existing contacts and leads are present with the same email. For this, we create a subflow to fetch the contacts and leads based on the input email passed. Also, to avoid unnecessary fetching of records, we can add validation to ensure the get records are performed only when the email is of valid email format. And in the main flow, we can refer the subflow in screen action and show the matching contacts or leads instantly. Attached are the screenshots.

Salesforce Fact #922 | Cloned from which record

Image
Suppose we want to track the record from which a record is cloned. We can make use of the isClone() and getCloneSourceId() functions in apex. Reference:  https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_sobject.htm#apex_System_SObject_getCloneSourceId Attached is sample code screenshot.