Showing posts with label Flow URL. Show all posts
Showing posts with label Flow URL. Show all posts

Thursday, 27 July 2023

Enhancing Record Processing: Automating Bulk Operation with Salesforce Flow from List Views

Requirement:

In an E-commerce sector project, the client based in Georgia, USA was required to implement bulk operation(To update multiple records simultaneously) from a list view button using salesforce flow.

Challenge:

As we do not have to use the apex class for this requirement, our main challenge was passing all the selected record Ids from the sObject's list view to the salesforce flow.

Solution:


Concisely, To achieve this follow the below steps:
  • Creating a screen flow with a variable named "ids" for delete operation.
  • Creating a List button with a custom URL.

 

  • To Create Screen Flow:
  • Go to the setup ⇒ Quick Find search box ⇒ Flows.  
  • After that click on New Flow and then select Screen Flow.
  • To create a collection variable go to the toolbox and click on New Resource button.
  • Select Variable as Record Type and Enter values as in below image.

 

  

[Note: API Name of the variable must be "ids".] 

  •  After that create a variable for record count to assign the count of the ids. 

 

 

  •  Add Decision Element and enter values as below.

 


  •  Add Delete Record element for Available outcome and add Screen element for Not Available outcome to display Error message. 

 

 

  • After Delete Record element add Screen element for success message.
  • Have a look on below image for flow reference.

 

 

  • To create a List Button with a custom URL:
  • Go to the Object Manager and open sObject(here it is Account) then click on "Buttons, Links and Actions" Tab.
  • Then click on "Create Button or Link" button and enter values as below in image and click on save button.

 

 

  • Here the custom URL "/flow/Delete_bulk_records?retURL=001/o" includes API Name of flow i.e. Delete_bulk_records and retURL=001/o to return to the Accounts List View page.
  • The value of retURL 001/o includes "001" is from first three character of record Id of Account sObject and "o" to redirect to the list view page.
  • After creating List Button click on List View Button Layout to add the List Button in List View Layout.
  • Edit the List view Layout, Scrolldown the cursor to the Custom Button and Add the created List Button in the Selected button list and save the changes. 

 

Output: 

 


Conclusion:

This is how the Automating Bulk Operation with Salesforce Flow from List Views is implemented which allows you to update multiple records simultaneously, saving time and effort.

  

If you have any questions you can reach out our Salesforce Consulting team here.

Thursday, 2 June 2022

Using the Button, send the Record Id to the Flow

Scenario :
While working on one of the requirements for a health sector project for a client based out of Melbourne, Australia there was a requirement to avail current record id in a flow by clicking a button for further actions.

Approach : 
The client wants a custom button on the Contact record page to launch the flow and avail the record id in a flow.

By passing the record id in a flow URL we can get the record id in a flow. Let's see with the example. 

Follow the below steps to create a flow.

Screen Flow :

Step 1:-  Define flow properties.
  • Click Setup.
  • In the Quick Find box, type Flows.
  • Select Flows then click on the New Flow.
  • Select the Screen Flow option and click on Next and configure the flow as follows:
    • How do you want to start building: Freeform
Step 2:- Flow variable
Define recordId Text variable to store Record Id.
  • Under Toolbox, select Manager and click on New Resource.
  • Input the following information,
    • Resource Type - Variable
    • API Name - recordId
    • Data Type - Text
    • Allow multiple values (collection) - Uncheck 
    • Available for Input - Check
  • Click Done.
recordId variable

Step 3:- Create Screen Element
We will create a screen element to display Record Id in this step.
  • Under Toolbox, select Elements. Drag and drop Screen onto the canvas.
  • Fill following Information on Screen Properties.
    • Enter Label the API Name will auto-populate.
    • under Components, select Display Text, Drag, and drop Display Text onto the screen. fill the following details.
      • API Name - Show_recordId
      • Insert a resource - {!recordId}
  • Click Done.
  • Connect start element to screen element.
Screen element

Our Flow is complete, Save and Activate the Flow. below is a diagram of the Flow.

Flow Diagram

Flow diagram

Now, Our Flow looks good. Let's create a custom button on the contact object and add a button on the contact page layout.

Custom Button

Follow the below steps to create a button on the contact object.

Step 1: 
  • Go to Setup > Object Manager
  • Select a Contact Object
Step 2:
  • Go to Buttons, Links and Actions
  • Click on New Button or Link 
Step 3:
Fill in the below details.
  • Label - Run Flow
  • Name - Run_Flow
  • Display Type - Detail Page Button
  • Behavior - Display in new window
  • Content Source - URL
  • Fill the below URL in the text area
/flow/Get_RecordId_In_Flow_Example?recordId={!Contact.Id}&retURL={!Contact.Id}

Click on the Save button.
Custom button

Add the custom button to the page layout

Below are the steps to add the custom button to the contact page layout.
  • Go to Page Layout. Select the edit option.
  • Select Mobile and Lightning Experience Actions from the panel.
  • Drag and drop Run Flow custom button to the Mobile and Lightning Experience Actions section.
  • Click Save.

Contact page layout
Output


Click here to see the Trailhead badge on Distribute the Flow with a Custom Button for more information.

If you have any questions you can reach out our Salesforce Consulting team here.