In my Org I have Custom_Object_A__c and Custom_Object_B__c. Custom_Object_A__c has a Lookup field to Contact and another Lookup field to Custom_Object_B__c. Custom_Object_B__c also has a Lookup to Contact.
I have a Trigger on Custom_Object_A__c which fires on Insert that looks at the two Lookup fields, if the Lookup to Contact is null, and the lookup to Custom_Object_B__c is populated, then I populate Custom_Object_A__c's Contact field with the value that is set in Custom_Object_B__c.
I am trying to move this functionality to the Process Builder. What I have so far...
- Custom_Object_A__c: Only when a record is created.
- Criteria: No criteria—just execute the actions!
- Immediate Actions: Update Record that started the Process.
Criteria for updating records: Updated records meet all conditions
- Lookup to Contact is null Boolean true
- Lookup to Custom_Object_B__c is null Boolean false.
Set new field values for the records you update
- Lookup to Contact
- Type: Reference
- Custom_Object_B__c.Contact ID
As best I can tell this should ONLY set the Contact Lookup on Custom_Object_A__c if on creation the Contact Lookup is null AND the Custom_Object_B__c Lookup is NOT null.
However when I try creating a test record for Custom_Object_A__c with the Contact Lookup filled, and the Custom_Object_B__c null I get an error
The record couldn’t be saved because it failed to trigger a flow
I also get an email stating
The flow failed to access the value for myVariable_current.Custom_Object_B__c.Contact__c because it hasn't been set or assigned.
I don't understand why it's even trying to look for this relationship?
Any ideas as to why this is happening?