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
Nick ValerioteNick Valeriote 

Passing Field Data in a Flow

Hi SF Developers,

I'm not a Developer, but rather an Admin who can dabble in code.  I was told by SF Support to come here with my question about a Flow request.

I'm new to Flow, but have worked out a flow that walks users through a series of screens in order to create a  SOW record (custom object)  via a custom button (New SOW) on a different object (Project). 

I want to pre and auto populate a few fields so the user doesn't have to do it, but I can't seem to figure it out.

1. Pre-populate Client field on Flow screen:
User-added image

2. Auto-populate Related SOW field on project page:
User-added image

I was given this set of instructions in order to accomplish the above two items, and I implemented these insturctions, yet it's not working.  Wondering if anyone can assist?

Instructions...
1. Create a Variable inside the Flow with the following specs:
> Label: recordId
> Type: Text
> Input/Output Type: Input and Output
2. Now, I assume the button would be calling the Flow by a link = 
/flow/Flow_Name?recordId={!Project__c.Id}
Update it like as above. Notice that we sending the Id of the Project record into the Variable inside of the Flow(this is why we set it to Input and Output)  - recordId

3. Now add a Fast Lookup inside the Flow(as the first element even before the Screen) that queries the Project object with a clause = 
Id equals {!recordId}
The result of the Fast Lookup will be an SObject Variable call it - project. Do not forget to query the fields that you are looking for from the Project record. 

4. You can then pre-populate the Screen Input Fields with the fields on the SObject Variable - project.

5. After you create the SOW record(I am not sure what you are using - Fast Create or Record Create but you should use another Variable to capture the Id of the SOW record that gets created), you can use an Assignment node to set the Related Account SOW field on the SObject Variable - project.

6. Then run a Fast Update on the same SObject Variable - project.

Here's a look at my Flow:
User-added image

Let me know if you need screen shots of more specific details in each flow element.
Thanks much!
Nick

Gaurav HandooGaurav Handoo
Hi Nick

Welcome to the world of Visual Flows, its interesting and frustrating (sometimes) at the same time.

To address your problem statement, following is what needs to be done (I'll go sequentially with your queries):
  1. Pre-Populating Client Name in screen:
    1. Create a Input Type Variable <ClientName> and <ClientId>
      1. URL to invoke the flow, should be something like this: <Flow Reference URL>?recordId=<Record Id field variable>&ClientName=<Project.Client__r.Name>&ClientId=<Project.ClientId>. Your nomenclature might be different based on the API Names of your fields and Objects.
      2. For your screen element, change the field from Text Box to Display Box and bind this variable to show the name.
  2. Updating Project with SOW:
    1. You don't need Fast Lookup item, instead simply use Normal Lookup element, with the saved SOW Id from Create element, to fetch the details (Name) of the record and assign the same to a variable <>.
    2. Use Normal Update element with following:
      1. Object Project
      2. Where clause: Id equals recordId.
      3. Field: Related Account SOW equals <Variable used for Name>.
Things you need to take off from the flow:
  1. Fast Lookup Project element
  2. Fast lookup SOW element. Instead use normal Lookup element.
  3. Assignment element
  4. Fast Update Project element. Instead use normal update element.
Things you need to change as per your org/desire:
  1. Variable names as per your desire.
  2. Field API Names as per your org.
Hope this helps. Please mark as best answer if it does.

In case you need any further support, feel free to connect at gaurav.handoo@gmail.com.

Cheers!!

Gaurav