You need to sign in to do that
Don't have an account?
Using process builder to update Contract look-up field on Opportunity when Opportunity = closed won
I have created an action in process builder to Create a new contract once the Opportunity stage = Closed Won.
This is occurs when a record is created or edited, and I have unchecked the checkbox asking whether to Allow process to evaluate a record multiple times.
So the criteria to be met is Opportunity Stage = Closed Won
The first action I have written is to create a new contract, with the fields as follows:
However, similar to how there is a lookup field on Contract Stage to link back to Account and (in this case, I have created another custom lookup field to link to Opportunity) Opportunity as well, I would like to have a lookup field on Opportunity stage to link to Accounts.
This Contract field on Opportunity object is just the mirror image of the Opportunity lookup on Contract object.
What I want to do is be able to, upon marking the Opportunity as Closed Won,
1) Create a new contract (all good this works already)
2) Update the previously empty Contract lookup field on Opportunity object with the Contract ID of the newly created contract.
I am having trouble completing step 2.
I tried adding another action to Update the contract lookup field on Opportunity object
But upon marking an opportunity as closed won, I get the following error
An error occurred at element myRule_1_A3 (FlowRecordUpdate). The flow failed to access the value for myVariable_current.Contract.Id because it hasn't been set or assigned.
Any ideas on how to automate this? Ideally, I would want users to be able to access the corresponding Contract immediately upon marking the Opportunity as Closed Won, as opposed to having to go to Contract object and searching for that contract.
I swear I'm somewhere close to the answer as I can successfully import the ID of the opportunity when creating a new contract (see first photo I inserted above)
Thanks!
Since you are trying to update opportunity field with newly created contract ID, I don't think you can do that in the same process. The reason is if you are trying to fetch the newly created contract's ID in the second action(Update Opportunity Record), you will not be able to do that because during that time the record was not committed to the database yet. And as a result, the ID field is not available to you.
As a solution, you can create another process builder which will execute when a new contract is created and have opportunity record as not null, in that case, you can update the opportunity's contact id with the associated contract id.
Please accept my solution as Best Answer if my reply is helpful.
All Answers
Since you are trying to update opportunity field with newly created contract ID, I don't think you can do that in the same process. The reason is if you are trying to fetch the newly created contract's ID in the second action(Update Opportunity Record), you will not be able to do that because during that time the record was not committed to the database yet. And as a result, the ID field is not available to you.
As a solution, you can create another process builder which will execute when a new contract is created and have opportunity record as not null, in that case, you can update the opportunity's contact id with the associated contract id.
Please accept my solution as Best Answer if my reply is helpful.
Thanks for your response.
I tried creating another Process with the following characteristics:
Object: Contract
ONLY When a record is created
Recursion - Allow process to evaluate a record multiple times in a single transaction? - Yes
Conditions
1) Contract.Opportunity_name__c ISNULL = FALSE
Immediate actions
Update records (see image)
I then activated both processes and changed the stage of an Opportunity to Closed Won.
I didn't get any errors, but the Contract field on Opportunity object still remained blank.
Maybe because I made it reference itself? I don't know how to get it to update itself with the ID of the corresponding contract.
But I'm pretty sure these are different fields. The first one is Contract ID on Opportunity object. The 2nd one is Contract ID from Contract object.
Any ideas?
Thanks
Took a bit of meddling around with the field titles because there were many contract fields and I kept getting confused.
Thanks for your assistance!
Hello.
I'm having the same problem with you.
I am so happy that you solved the problem.
I'd appreciate if you show me the last config screen shot.
Thanks.