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
Eric BlaxtonEric Blaxton 

Pass current Opportunity ID into Flow variable

Good morning and thanks in advance,

Requirement is when a new opportunity is created:
1.Lookup an Opportunity Team Member name whose role equals "Primary SE"
2.Copy that name into a custom field on the opportunity. Field name is "SE"

I was told to use a Process to trigger a Flow where most of the logic willl be placed.  

One question so far:
1. How to pass the current op id into the flow, so the flow knows which op to update
 
Best Answer chosen by Eric Blaxton
Eric BlaxtonEric Blaxton
Hi, Almost there. No errors, but the field isn't actually updating I am including some information. Here is what I do: 1. Record lookup on the Opportunity Team object and I look for name of the person in the role of 'Primary SE' 2. Then I store that in a variable "!SE_Name". I have tried changing the variable type between text, number or picklist. I can get the name of the SE, The variable "!Se_Name".3. The problem I am running into is when I try to update the field on the op. It's a Lookup field. What data type should I put the name into so that I can move it into a lookup field? Thank You, Eric Blaxton

All Answers

Krishna SambarajuKrishna Sambaraju
In your flow create a variable opportunityId and set it as input. Make sure to set the Type as "Autolaunched flow" when saving the flow and activate it.
Then create a process using process builder. Select the object "Opportunity" and "only when a record is created" for Start the process and click save.
Set the conditions in "Define Criteria for this Action Group" and click save.
In the immediate actions section, add a new action and in the action dropdown select Flows. Specify the action name and in the Flow drop down select the flow you want to launch.
In the Set Flow Variables section select enter opportunityId, set the type as Reference and the value as [Opportunity].Id, and clidk Save and activate the process.

Hope this helps.
 
Eric BlaxtonEric Blaxton
Hi, Almost there. No errors, but the field isn't actually updating I am including some information. Here is what I do: 1. Record lookup on the Opportunity Team object and I look for name of the person in the role of 'Primary SE' 2. Then I store that in a variable "!SE_Name". I have tried changing the variable type between text, number or picklist. I can get the name of the SE, The variable "!Se_Name".3. The problem I am running into is when I try to update the field on the op. It's a Lookup field. What data type should I put the name into so that I can move it into a lookup field? Thank You, Eric Blaxton
This was selected as the best answer
Krishna SambarajuKrishna Sambaraju
You need to set the id to the lookup field, not the name.
Eric BlaxtonEric Blaxton
I was able to get this part figured out. Well almost, I can populate the field based off the op team member role, but there is an issue. No matter who I log in as, I am pulling my op team member and not the current users op team member.
Eric BlaxtonEric Blaxton
@Krishna Sambaraju, Thanks for your help.

One more thing.  I may have designed this wrong.  I was assuming the Default OP team was assigned to a New Op upon creation of the record.  How do I access the current users default op team, find the id of the person in  a certain role and populate custom fields on the op.

I can do almost all of this.  The exception is my own Default Op team Se is being assigned to all new ops even if i am signed in as another user?