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
Mohit Halkare 2Mohit Halkare 2 

Workflow or Process Builder Champions

I need help to create a workflow or process to update one field after checking another field from an Object which is a child of a Grand Parent Object.

Example:-
C is child of B 
B is child of A
K is also another Child of A

I need a workflow or process that when C is created, a field in C should be updated from a field in K.

I cannot use formulae as the field in C should be editable later.
 
Mohit Halkare 2Mohit Halkare 2
The field in K is already existing (not being created or updated). The solution needs to check all records in K and get the correct record to get the field value from that particular record in K. That field needs to be updated in C.
jigarshahjigarshah
Mohit, 

Since iteration on multiple records is involved, then there are only 2 approaches that I can think of which will help address your requirement.

Approach 1
  1. Create a Process Builder on C that fires whenever the respective field value on C is added or modified.
  2. The process builder should use an Invoke an Apex Class action to invoke an Apex class marked with @Invocable annotation and contains the logic to iterate over multiple records of K associated with A and return the respective field value on K.
  3. The value returned from Step 2 can then be stamped on the respective field in C.
Approach 2
  1. Write an After Insert / Update Apex Trigger on C which invokes the business logic in Apex to iterate on associated records of K and update the respective field value on C.
One thing you should definitely cosnider is, if A is related to K with a Master Detail relationship and if the field value on associated K records, can be updated on A via a Rollup Summary function i.e. MAX(), MIN(), AVG(), COUNT(), SUM() then you can still use the earlier suggested out of box approach. If not then the above suggested approaches will help you accomplish the requriement.
Mohit Halkare 2Mohit Halkare 2
This is exactly the correct solution using Apex. I also need a Declarative way of doing this without Apex.
jigarshahjigarshah
Mohit,

I am afraid that this may not be achieved using declarative artefacts, considering the branched relationship hierarchy of the objects invovled in the transaction. However, you can consider the Rollup Approach stated above which may help.
Mohit Halkare 2Mohit Halkare 2
Usually how much time will this implementation take if I consider giving this as a job to a developer who knows how to write this code?
jigarshahjigarshah
Should be about about 8 to 16 hrs. considering.
  • Development
  • Test Code
  • Unit Testing
  • Production Deployment
However, this may vary.
jigarshahjigarshah
Mohit,

Please mark this thread as solved if your query has been addressed.
Mohit Halkare 2Mohit Halkare 2
Hi, I am waiting if anyone could offer a declarative solution to this issue. Regards, Mohit Halkare Co-Founder & CTO Vio Inc. #700, 12323 Stony Plain Road, Edmonton, Alberta Canada, T5N1L1 Mo. No.: +1 587 926 5706 Direct Line : +1 780 453 9843 Email : mohit@vionow.com Website : http://vionow.com/