Posts

Salesforce Fact #403 | Fetch custom metadata from apex to avoid SOQL count

Image
We know that SOQL on custom metadata in Apex does not count towards the governor limit but it gets counted in Get Records of flow. So, in order to avoid the count we can call an apex method from flow which will fetch the custom metadata records and would return them in flow. Attached are the screenshots.

Salesforce Fact #402 | Improvement scope in flow auto-layout

Image
The freeform layout in flow seems to be more organized and understandable to the developer. But do you know if you have a step element or if you have an element which is not connected to the start element, the flow cannot be opened in auto-layout. In this example, I was calling an apex method from flow. Now, just to compare the stuffs once I kept the apex action disconnected and added a Get Records in place of that, I am not able to open the flow in auto-layout. This kind of checks are quite helpful when you need to test out something quickly while developing the flow and disconnect a particular element from the operation and add it back once tested. Let's hope, this will be supported in auto-layout in the coming days. Attached are the screenshots .

Salesforce Fact #401 | Record Id issues in DML errors

Image
We often come across DML errors while updating records. Let's see what could be the possible reasons related to record Id. Attached is the screenshot.

Salesforce Fact #400 | Convert Leads

Do you know there is an app permission named 'Convert Leads' which gives you the ability to convert leads.  Here is the step to enable it: Open the profile/permission set ->  Go to App Permissions -> Under Sales, select the permission with the name ' Convert Leads'. Once it is enabled, you would see the Convert button in quick actions list on Lead record page.

Salesforce Fact #399 | View and Edit Converted Leads

Once a Lead gets converted, we are not able to see it anymore in the UI. If we try to open the record detail page of that lead using record, it navigates to the related Account/Contact record page. But do you know there is an app permission which lets you view and edit converted leads. The permission is 'View and Edit Converted Leads'. Here is the step to enable it: Open the profile/permission set ->  Go to App Permissions -> Under Sales, select the permission with the name ' View and Edit Converted Leads'. Salesorce doc link:  https://help.salesforce.com/s/articleView?id=sf.leads_view_edit_converted.htm&type=5

Salesforce Fact #398 | Failed time triggered actions get rescheduled

Image
According to Salesforce help doc, If a time-based action fails then Salesforce attempts to execute the action again after some time. Let's see it in action. In this example, we have a lead assignment rule setup which assigns the created lead to a particular queue. We have setup a scheduled path in record triggered flow to send out an email to the record owner after 1 minute of lead creation. Now, by mistake the lead queue email is not there. So, as a result the scheduled action fails and it gets rescheduled by Salesforce to a future time. Attached are the screenshots.   Also do you know Workflow time triggers are batched and executed every 15 minutes. For details, please check: https://help.salesforce.com/s/articleView?id=000329332&type=1

Salesforce Facts #397 | Scheduled flow recurring run on weekdays

Image
We know that scheduled flow are good for running daily, weekly tasks. But what if we want to run it in recurring mode like after 5 days. And also we would like to skip saturdays and sundays. We can achieve this by including some checks on current day and also using custom labels and custom settings. In this example, we have a scheduled job which would run every 5 days i.e. day1, day6, day11 like this. For this, we can create a custom label containing the shortform of day of week. Now, we can create a custom setting which would store the counter value. The logic is if the current counter value is 0, that means it is a valid day to run the job else it is an invalid day. Now in the scheduled flow, we would check if the current day is a weekday and if the counter is 0, then job runs today. Else, if it's a weekday and counter > 0, job won't run. In both the cases, we would update the counter by 1 and store the MODULO result in the counter for the next time run. If it is a weekend...