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
Doug Traster 4Doug Traster 4 

Not sure why Process builder works for one object, but not another

Hello

I have a requirement that asks me to show child opportunities and child tasks(activities) on the parent account.  I have created Parent/Child Hierarchy for the accounts.  What they want is anytime a sales person creates an opportunity or a task on a child, they see it in a related list on the parent.

I created 2 lookup fields.  One on Opportunity and one on activity custom fields.  

I then went to Process Builder and used the following:

For Opportunity -- 

Choose Object and Specify When to Start the Process
Object * Opportunity
Start Process* When record is created or edited

Define Criteria for this Action Group
*No criteria- just execute the actions

TRUE >Immediate Actions>Add actions>

Select and Define Action
Action type*Update Records

Record type > Select a record to update* Select the Opportunity record that started your process

Criteria for Updating Records* No criteria- just execute the actions

Set new field values for the records you update***
Field* Parent Account Lookup 
Type* Reference
Value* Account.ParentId

and for TASK --

Choose Object and Specify When to Start the Process
Object * Task
Start Process* When record is created or edited

Define Criteria for this Action Group
*No criteria- just execute the actions

TRUE >Immediate Actions>Add actions>

Select and Define Action
Action type*Update Records

Record type > Select a record to update* Select the Task record that started your process

Criteria for Updating Records* No criteria- just execute the actions

Set new field values for the records you update***
Field* Parent Account Lookup 
Type* Reference
Value* Account.ParentId 

What I am running into is that it works fine for the Opportunity.  They can create an opportunity on a child or the parent account with no problem.   It is when I use the Task it errors.  They cannot create a task on the parent account????  I get a Flow error.

Error element myRule_1_A1 (FlowRecordUpdate).
This error occurred when the flow tried to update records: The flow failed to access the value for myVariable_current.Account.ParentId because it hasn't been set or assigned.. For details, see API Exceptions.

Any ideas why or how I can fix this?

Thanks!!!!

 
Phillip FrontPhillip Front
I'm guessing you're getting the error on a task that's not associated with any account? You might want to check out this help article for more info: https://help.salesforce.com/articleView?id=Process-Builder-Update-Related-To-record-from-Task-or-Event&language=en_US&type=1

To prevent the error on tasks w/out Accounts, you'd want to add a criteria to the update: "WhatId Starts With 100". Hope this helps!
Doug Traster 4Doug Traster 4
Philip

Using this allows me to do a task on the Parent account, but then the child tasks will not show on the parent account related list.  

that is the main issue, I need to have the child tasks show in the lookup related list on the parent account.  I even played around with it for a while, and changed the fields, etc.  couldn't get it to work.  Not sure this really relates to my issue........

 
Phillip FrontPhillip Front
Got it. I'm pretty sure there is no easy process builder hack that will help you here. The easiest way is probably to create a Visualforce related list that displays all tasks under the account and child accounts, then add that to the layout. Maybe someone else will know an easier way, but that's the best way I can think of. Good luck!