In the last article Add Record to Multiple Chatter Groups – Parsing Multi-Select Picklist fields (Flow) I have promised to discuss the way to call a flow from publisher action, so lets start with a business scenario.
Business Use case
System Administrator in Universal container created a flow to add Opportunity record to multiple Chatter Groups. They have received a requirement from business user to make this flow available as publisher action on Opportunity object.
Solution for the above business requirement
To solve the above business requirement we will embed the flow in a Visualforce page. To do that follow the below instructions
1) Copy the Unique Name of the flow (which you want to embed in a Visualforce page) from flow detail page, as shown the following screenshot
2) To embed the flow in a Visualforce page, Click on Setup | Build | Develop | Pages and click on the New button to create a new Visualforce page, below is the sample code for your reference
Add Record to multiple Chatter Groups
3) Save the Visualforce page.
4) Create a publisher action on Opportunity object to call the Visualforce page. Click on Setup | Build | Customize | Opportunities | Buttons, Links, and Actions and click on New Action button and enter the details as shown in the following screenshot
5) Click on Save, once you are done.
6) Add the newly created action (Add Record) on the Opportunity Page layout. Navigate to Setup | Build | Customize | Opportunities | Page Layouts and click on the Edit link, Add Publisher action Add Record onto the page layout as shown in the following screenshot
7) Once you are done with modification, click on Save.
It’s time to test this feature
To test this flow, follow the below instructions
1) Go to the Opportunity Detail page, and click on Add Record publisher action, as shown in the following screenshot
Note :- I will suggest you to Implement this first on your developer org test it and then move it to Production.