I am trying to create a custom "Log a phone call" button, the button will be displayed on the related list of Activities on an Account Record.
The button will use a Visual Force page as its source so that it can trigger a visual work flow.
The issue is I need to pass the AccountId of the parent Account that the related list is on as a parameter to the flow.
But when I select Visualforce page as the source it will only let me select the Visualforce page if it uses the standard Task controller.
How can I get the Account Id of the record I am on when I click the custom button on the related Activities list?
Best Answer
Your VF page could use a
StandardController
forActivity
and then your VF page'saction
attribute could execute a method which takes theid
from the record and performs a redirect to the flow URL providing that ID as a parameter.The VF page needs no markup in it other than the
<apex:page standardController="Task" extension="yourClass" action="yourMethod" >
since no content will be rendered by this page to the end user.It's just acting as a router to create the URL to the flow and redirect the user.
https://developer.salesforce.com/docs/atlas.en-us.salesforce_vpm_guide.meta/salesforce_vpm_guide/vpm_url_setvar.htm
The VF page
The controller
Activity "Log a Call" button override
Resulting URL after clicking "Log a Call" button on an Account's Activity History related list
https://domain.my.salesforce.com/someflowUrl?title=Call&what_id=001G00000229ESC