#1: Trigger a Flow to Run After a Record Is Saved
Earlier a record-triggered flow could only execute before the save of a record. But Summer-20’ Release brings to you the feature where flows can be executed after the save of a record. This would make many people revisit the current implementation of Workflows and Process-Builders which initiate a flow after the edit of a record. Nevertheless it is always a good idea to revisit your Apex Triggers to see which fragments can be put into a Flow / Business Automation.
We will take an example and build it to execution. So we will consider the case where we will do a custom rollup using a flow (Except the Delete Case). This can help us to remove a few plugins (Apps) and Triggers if used.
Lets click on the Gear Icon and Click on Setup. Once the setup menu is loaded, in the quick find type Flows and click on it. Then lastly click on New Flow to begin creating a new flow.
In the New Flow dialogue, select Record-Triggered Flow and hit Create
On load of the canvas screen Click on Edit
When we click on Edit it will open a new dialogue to configure the flow execution and related context of execution. On this dialogue under Trigger the Flow when: select “A record is created or updated”
After we configure the execution pattern for the flow we would select the Object on which the trigger would execute.
In this example we will go ahead and select Contact as any Edit/ Creation of Contact should update the Count of Related contacts on the Parent Account.
We will go ahead and save our changes so far so we do not miss on the basic configuration and setup of our flow.
We would now drag drop the Get Records to the canvas from the left.This would help us to get all Contacts related to Parent Account. We pass the condition to get all Contacts with the AccountId being the same as the current Contact’s AccountId.
As a part of the next step we will get the Parent Account related to the current Contact updated / inserted. We will drag Get Records from the left and place it to the Canvas. We are getting this information as we would need to stamp the count of related contacts on this particular Account i.e the Parent in this case.
The final configuration of Account should look similar to the below reference
In this step we would be calculating the number of related Contacts to the parent Account and storing the value to a variable. For this we will drag Assignment to the canvas and set the value of the variable to the Count of Contacts which we got in the previous step. We will be using this value in the variable to overwrite the count of Employees under an Account.For which we will select the field ParentAccount.Employees from Account and assign to it the count of child contacts.
As a final step we will be Updating the parent Account with the value we assigned in the previous step. For this we will drag drop Update Records to the canvas and select the parent Account that we want to Update.
Hit Save and give your Flow a name.
Also Activate the Flow before rushing out to test.
Create an Account record and also ensure to add the Number of Employees (Employees) to the Page Layout of Account.
Now create a couple of Contact records under the Account record. And refresh the Account page to see the numbers reflecting the actual number of Contacts related to Account.
Scenarios where we need to Manipulate data / perform business logic via point and click this feature would be helpful to cover a considerable amount of cases. Hence reducing the pain to write custom Apex.
#2: Scan a Barcode in a Lightning Web Component (Beta)
My second favourite and something that I am truly excited about is the ability to Scan the BarCodes within Salesforce via a LWC component development. And something that I am really looking forward to implementing for my partners. Although this is in Beta right now but expecting it to be GA in near future.
Some scenarios where this would be helpful:
- Adding products to Opportunity via scanning bar-code of Product
- Tracking status of Shipment of Product in relocations
- Simplifying product lookup
Let us consider a Use-Case where a QRCode scanner would be helpful using the first two scenarios from above. Let us assume a company deals in physical products and requires to ship the Product to the customer address. Inside Salesforce the sales representative can take customer requirements in the form of LineItems. But the Store Manager has to confirm the Availability of each line item and furnish extra attributes to each line item. In the current scheme of things this is a pretty cumbersome job and prone to error due to manual entry. Further the company updates the location of each product manually by validating items and updating that the item has reached a particular destination. This too is a manual entry and takes up quite some time to key in the information across each location.
The IT department wants to rethink the implementation and wants to automate the steps so there is minimal data entry being performed. Inorder to accomplish this, they propose and tend to implement the following flow. Whenever a Product is manufactured a QRCode is generated and associated to the product. Now when a Sales representative gathers the requirements of products he can add the line items as earlier. But now the warehouse manager’s work is automated. He looks at the request and locates the Item in the Warehouse. He then scans the item using his Mobile Device / Surface / iPad. This would get all details from the QRCode and update the Opportunity with additional details from the scan (manual step eliminated). This would also restrict addition of duplicate items by putting in checks in place. Now all the Warehouse Manager has to do is to look for the requests on Opportunities and scan the physical products which get associated to the Opportunity with all necessary information that was keyed in while generating the QRCode and the scan.
As a next step to the process when the product is in transit the location of each product can be gathered again by scans at the location warehouse / user account performing the scan. This step ensures that there is zero manual entry of data to Salesforce hence reducing the overall effort and increasing the quality of data and overall process.
The only consideration that was to be made was the architectural-design and flow of Web-Components. Which in result ensured the process is streamlined and effective.
Since QRCode scan would require some Apex and LWC development hence a due-diligence for use-case and architecture would be required. But if implemented right, then this would cutdown on the time spent by users to make things simpler.
Using QRCode scanners can be pretty helpful in simplifying the overall user experience and hence cutting down on time spent. Although a point to consider would be the cost of development should be scaled to analyze which is carrying the weighted advantage.
I hope you get to utilize the above features in some form or fashion for your organization or customers. Please feel free to leave reviews about your experience in the comments below.