1

Process automator can be used to automate a lot of things within salesforce. For one such scenario can I use it to count the number of instances of a certain object and then set a checkbox value to true?

Certification sObject(Parent) --> Exam sObject(Child) [Master-Detail-Relationship]

Say a person passes all 4 Exams under a certain Certification, I want the process automator to count the number of passed exams, and if it is 4, set a checkbox in the Certification object to True.

Can this be done without an apex code or trigger?

6
  • 2
    Is it a master detail relationship? Do you try to create a Roll Up function in the Master and test it using Process Builder?
    – m Peixoto
    Commented Nov 29, 2018 at 10:11
  • it is Master-Detail-Relationship Yes. No i did not try the roll up function. I will do some research and try that out. Commented Nov 29, 2018 at 10:17
  • 1
    Another option is to create a flow to count the number of children. Call the flow from the process builder.
    – m Peixoto
    Commented Nov 29, 2018 at 10:29
  • can this count the number of children with certain properties, in my case, children with "passed" as a value in a field Commented Nov 29, 2018 at 12:00
  • 1
    @NivethKumar : yes Commented Nov 29, 2018 at 13:17

1 Answer 1

1

Based on this documentation, you cannot use a Roll Up formula field because it will calculate after the insert or Update (link).

So, the solution without code:

  1. Create a flow that there the ParentID as an input variable and make your logic in the flow
  2. Create a Process Builder.

  3. Use No criteria—just execute the actions! on Decision option.

  4. Call the Flow sending the Parent ID (stored in child record) in the Immediate Action option

It will run only if the Parent never changes. If the Parent could change, you will call the flow two times, using the Old and the New value. For that, you will need to use a formula field to send the ID to the flow.

Another option is to create two formula fields

  1. A Roll Up formula field to count
  2. A Formula field testing the Roll Up result. If it is equal or more than 4, the Certification approval is True, else it is False.
2
  • The roll up formula worked, thanks alot. I used the count function to get the number of child records, then filtered it using the criteria method to get the people who passed. Commented Nov 30, 2018 at 4:15
  • Good to know that I helped you!
    – m Peixoto
    Commented Nov 30, 2018 at 9:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .