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
Steve CairneySteve Cairney 

Process Builder, Flows and creating objects. Creating a related object.

Hi, I have a articular use case for Process Builder and flows but I can't get it to work.

There are two obects involved, Opportunity and a custom object MC

I have created a process that when triggered creates the MC object on the Opp that triggered the flow

The next step is to create a new Opp based on the first Opp. I can do this in Process fine. But what I need to do is create a new MC object on the newly created Opp.

I can't do this with Process as all it does is add two MC objects to the original Opp.

I've tried to create the new Opp with a flow nd put that in the Process but I can't get that to work yet and I'm still not sure I'll be able to add a new MC object to that created Opp.

Does anyone have any advice?
Steve CairneySteve Cairney
Here are the outputs from the Process
 
Flow Details
Flow Name: Digital_Split_with_MC
Type: Record Change Process
Version: 10
Status: Active
Org: xxxxxx
Flow Interview Details
Interview Label: Digital_Split_with_MC-10_InterviewLabel
Current User: Steve Cairney (00520000003F9g9)
Start time: 11/10/2018 09:23
Duration: 0 seconds
How the Interview Started
Steve Cairney (00520000003F9g9) started the flow interview.
Some of this flow's variables were set when the interview started.
myVariable_old = Opportunity (0061l000002HtCEAA0)
myVariable_current = Opportunity (0061l000002HtCEAA0)
RecursiveCountVariable = 0.00
ASSIGNMENT: myVariable_waitStartTimeAssignment
{!myVariable_waitStartTimeVariable} Equals {!$Flow.CurrentDateTime}
Result
{!myVariable_waitStartTimeVariable} = "11/10/2018 09:23"
DECISION: myDecision
Executed this outcome: myRule_1
Outcome conditions: 
1. {!myVariable_current.StageName} (Closed Won) Equals Closed Won
2. {!myVariable_current.Use_Once_Process__c} (false) Equals false
3. {!myVariable_current.Passed_to_Digital__c} (true) Equals true
4. {!myVariable_current.Previous_Owner__c} (Steve Cairney) Does not equal Ricardo Seixas
Logic: All conditions must be true (AND)
RECORD CREATE: myRule_1_A1
Create one Media_Costs__c record where:
Cost_Price__c = {!formula_2_myRule_1_A1_5568048464} (£495.000000000000000000)
Media_Owner__c = 0011l00000360eK
Media_Type__c = Digital
Opportunity__c = {!myVariable_current.Id} (0061l000002HtCEAA0)
Result
A record is ready to be created when the next Screen or Wait element is executed or when the interview finishes.
RECORD UPDATE: myRule_1_A2
Find all Opportunity records where:
Id Equals {!myVariable_current.Id} (0061l000002HtCEAA0)
Update the records’ field values.
Split_Margin__c = {!myVariable_current.Margin__c} (990)
Use_Once_Process__c = true
Result
All records that meet the filter criteria are ready to be updated when the next Screen or Wait element is executed or when the interview finishes.
PROCESS_FLOW (FLOWS): myRule_1_A3
Inputs:
Opp = {!myVariable_current} (Opportunity (0061l000002HtCEAA0))
Error Occurred: An error occurred when executing a flow interview.

And here is the output fromn the flow
 
Flow Details
Flow Name: Process_Flow
Type: Autolaunched Flow
Version: 3
Status: Active
Org: xxxx
Flow Interview Details
Interview Label: Process Flow 11/10/2018 09:23
Current User: Steve Cairney (00520000003F9g9)
Start time: 11/10/2018 09:23
Duration: 0 seconds
How the Interview Started
Steve Cairney (00520000003F9g9) started the flow interview.
Some of this flow's variables were set when the interview started.
Opp = Opportunity (0061l000002HtCEAA0)
RECORD CREATE: Create_Opp_For_Process
Create one Opportunity record where:
CloseDate = {!Opp.CloseDate} (10 October 2018)
Name = {!SplitOppName} (TEST)
StageName = {!Opp.StageName} (Closed Won)
Result
A record is ready to be created when the next Screen or Wait element is executed or when the interview finishes.
{!OpportunityID} = 0061l000002HuFvAAK
RECORD UPDATE: Update_Record
Find all Opportunity records where:
Id Equals {!OpportunityID} (0061l000002HuFvAAK)
Update the records’ field values.
AccountId = {!OpportunityID} (0061l000002HuFvAAK)
Result
Failed to update records that meet the filter criteria.
Error Occurred: The flow tried to update these records: null. This error occurred: FIELD_INTEGRITY_EXCEPTION: Account ID: id value of incorrect type: 0061l000002HuFvAAK. You can look up ExceptionCode values in the SOAP API Developer Guide.