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
Madhusudan Singh 19Madhusudan Singh 19 

Not able to find the logic for below scenario

User-added imageIf a Job Item is deleted then those job tasks should also get deleted which are the subset of the tier values of the Job Items, but if a job task having a higher tier value available but then its subset should not get deleted.

In the above example is Job Item JI1 is deleted then JobTask JT7 and JT3 should also be deleted.
JT6 should not be deleted as it has a higher tier value(Tier7)
JT5 should not be deleted as it is a subset of the tier value of JT6
JT4 should not be deleted as it is a subset of the tier value of JT6 and JT5
JT2 should not be deleted as it is a subset of the tier value of JT6, Jt5, JT4
JT1 should not be deleted as it is a subset of the tier value of JT6, Jt5, JT4, JT2

JT7 should be deleted as it is not a subset of any Job Task
JT3 should be deleted as it is a subset of the Job Task which is getting deleted and it is also not a subset of any other Job Task that should not be deleted

Any idea how can we do it?

I tried a few logic but it didn't work out, can anyone please help me.