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
Natalia Rex 1Natalia Rex 1 

Unable to pull related record via flow (flow and debug log included)

Hello everyone, for the last few days I've been trying to figure out how to update a flow that pulls information from a few object and updates/creates a new one. There's one field I"m wanting to pull, and no matter what I do I can't find the best solution. Here's the entire process:

1. When an Opportunity is changed to Closed Won, it starts a Flow, like below:

User-added image

2. We have a custom object called Project, so when this flow begins, it pulls specific information from the Opportunity referenced above, creates that new record (Project) along w/ a task, and updates some information in the referenced opportunity. At the very end I will explain what one field I'm wanting to pull.

User-added image

Here's the debug log of what all happpends, what is pulled and updated :

Natalia -- (XXXXX) started the flow interview.
API Version for Running the Flow: 49
Some of this flow's variables were set when the interview started.
process_opp_id = 0063N00000Av7krQAB
Flow start time: December 11, 2020, 2:23 PM.

Find all Opportunity records where
Id Equals {!process_opp_id} (0063N00000Av7krQAB)
Store the values of these fields in Get_Process_Opp: Id, AccountId, Start_date_of_project__c, End_date_of_project__c, OwnerId

Result
Successfully found records.

Find all Account records where
Id Equals {!Get_Process_Opp.AccountId} (0013N00000J61umQAB)
Store the values of these fields in Get_Account: Id, Name, BillingStreet, BillingPostalCode, BillingCity, BillingCountry, E_Mail__c

Result
Successfully found records.

Create one Project__c record where
Account__c = {!Get_Process_Opp.AccountId} (0013N00000J61umQAB)
End_Date__c = {!Get_Process_Opp.End_date_of_project__c} (16 December 2020)
From_Opportunity__c = {!process_opp_id} (0063N00000Av7krQAB)
Invoice_City__c = {!Get_Account.BillingCity} (Będzin)
Invoice_Country__c = {!Get_Account.BillingCountry} (Poland)
Info
Invoice_Email__c = {!Get_Account.E_Mail__c} (null)
Info
Invoice_Postal_Code__c = {!Get_Account.BillingPostalCode} (null)
Info
Invoice_Street__c = {!Get_Account.BillingStreet} (null)
Name = New Project - {!Get_Account.Name} (New Project - SH test)
Project_Owner__c = {!Get_Process_Opp.OwnerId} (0053X00000B3ZWcQAN)
Start_Date__c = {!Get_Process_Opp.Start_date_of_project__c} (02 December 2020)
Status__c = Preparation (Kick-Off)

Result
A record is ready to be created when the next screen, pause, or local action is executed or when the interview finishes.
{!created_project_id} = a023N000004PGHEQA4

Create one Task record where
ActivityDate = {!$Flow.CurrentDate} (11 December 2020)
OwnerId = {!Get_Process_Opp.OwnerId} (0053X00000B3ZWcQAN)
Priority = High
Status = Open
Subject = Project Kick-Off
Type = Project Kick-Off
WhatId = {!created_project_id} (a023N000004PGHEQA4)

Result
A record is ready to be created when the next screen, pause, or local action is executed or when the interview finishes.

Find all Opportunity records where
Id Equals {!process_opp_id} (0063N00000Av7krQAB)
Update the records’ field values.
Project__c = {!created_project_id} (a023N000004PGHEQA4)

Result
All records that meet the filter criteria are ready to be updated when the next screen, pause, or local action is executed or when the interview finishes.

What I am wanting to do , is to pull a Quote Won that is related to the opportunity we are referencing, because the Quote Won has a special field "Partner", that I want to be included in the Project.

User-added image

The closest thing I was able to do, was to create a formula filed on the Project Record, with a formula which ended up pulling the right "Partner" account name from the quote, but then that is NOT clickable, so this is why I need the field to be a lookup field that pulls that information.
User-added image

The field "Quote won partner account" this type.
User-added image

I want the above Account be the account in the "Parter" field that has been created on the Quote that was won.

On Quote, its already a Child of Opportunity, so I thought I could just pull it, but I'm not sure where I need to edit the code, or the flow. Should I have a separate "Get records = quote", or try another way?

 

many thanks in advance,

Cheers,

Natalia

ANUTEJANUTEJ (Salesforce Developers) 
Hi Natalia,

>> https://jenwlee.com/2020/07/27/lets-get-with-the-flow-update-a-related-record-in-a-loop/

The above link has an example of fetching related record, can you try checking it once?

Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.  

Thanks.