In the last article “Add Record to Multiple Chatter Groups – Parsing Multi-Select Picklist fields (Flow)” I have promised to discussed 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 of 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
<apex:page standardController="Opportunity"
Showchat="False">
<br/>
<Center><Font size ="6" color
="gold">Add Record to multiple Chatter
Groups</font></Center>
<br/><br/>
<flow:interview
name="Add_Record_to_multiple_Chatter_Groups"
finishLocation="/{!$CurrentPage.parameters.id}">
<apex:param
name="VarTOpportunityID" value="{!Opportunity.Id}"/>
</flow:interview>
</apex:page>
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
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
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.
Post a Comment