0

SObject: Student[Parent] and SObject: Exam[Child] (master-detail relationship)

An exam candidates who has to take 15 types of exams, and where he can only take an exam maximum twice. If he fails more than once in any exam, he will be out of the school. when the student fails twice, a custom field in the student object should be set to failed.

I can not have multiple roll up fields for every exam type, is there another way without using apex code or triggers to do this?

2 Answers 2

1

Assign each exam type a hidden number as follows: 1, 10, 100, 1000, etc... Salesforce lets numbers go up to 18 digits right?

Create one roll-up summary that adds up the hidden exam numbers from failed exams. A workflow rule or Process Builder checks if the sum contains a 2, and if it ever does, the student is set to failed.

If you had more than 18 exam types, you could always go with a more compact base system than base 10 but the condition of the Process Builder would then be somewhat harder to write.

Another alternative, if you are willing to use a Flow autolaunched by Process Builder, you could simply write a Flow that checks for the same exam failed by the same student, and if it finds it, update the student to Failed.

1
  • writing a flow as in? any examples or reference will be helpful Commented Jan 29, 2019 at 21:24
1

Without Trigger/Apex/Rollup the only thing left is WF/Process Builder. If you want to achieve it using WF only, then you need to create lots of field and validation rule to maintain this.

Basic Idea is to create a count type field(Like custom rollup) and update it from WF by 1. Now create a validation rule which checks if the value is greater then 2 then throw an error.

My rough idea is you will need 15 number fields, 15 WF rules and 1 validation rule to cover all this.

You must log in to answer this question.

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