function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ram_iyerram_iyer 

How do I link a Visual Workflow to the current record?

How can I use Visual Workflow to update a field on a record?

I have a button on an Account that triggers a Visual Workflow. Based on some steps in the workflow, I would like to update some fields on the Account that the user began from. How can I achieve this? I am unable to get to the current record. 

Best Answer chosen by Admin (Salesforce Developers) 
RajaramRajaram

You need to do a couple of things:

1. Create a variable in the flow called vaAccountID

2. When you create the custom button or link, set the url to be /flow/myFlow?vaAccountID={!Account.Id}

 

This will pass the Account ID to the flow. Once you do this, you can query any other fields you want from the account using the record lookup element within the flow.

 

You can alternatively create as many variables as you need inthe flow and set them accordingly in the link. So, if you want the Account  Name and Annual Revenue in the flow your URL for the custom button would be

/flow/myFlow?vaAccountName={!Account.Name}&vaAnnualRevenue={!Account.AnnualRevenue}

 

Hope this helps..

All Answers

RajaramRajaram

You need to do a couple of things:

1. Create a variable in the flow called vaAccountID

2. When you create the custom button or link, set the url to be /flow/myFlow?vaAccountID={!Account.Id}

 

This will pass the Account ID to the flow. Once you do this, you can query any other fields you want from the account using the record lookup element within the flow.

 

You can alternatively create as many variables as you need inthe flow and set them accordingly in the link. So, if you want the Account  Name and Annual Revenue in the flow your URL for the custom button would be

/flow/myFlow?vaAccountName={!Account.Name}&vaAnnualRevenue={!Account.AnnualRevenue}

 

Hope this helps..

This was selected as the best answer
QualquunQualquun

Rajaram! You are my absolute favorite ever! THANK YOU.

J Roge.ax1108J Roge.ax1108

hi this is exactly what i am trying to do i want a button on my opportunity screen which my account managers can click to update certain fields on that opportunity any screen your advice on how to do this it would be much appreciated :)

kdcSFDCliferkdcSFDClifer

THANK YOU FOR THIS!!! 

dana.coderdana.coder
This works great. Remember to set the flow variable as input to allow it to be saved. This took me a little while to figure out why the variable wasn't being updated. Also, the "va" prefix is not required.