You need to sign in to do that
Don't have an account?
Vaibhab Shah
Reparenting records | Complex Trigger
Hi,
I have a custom object which has 2 fields:
1. Immediate Parent (Self Relationship)
2. Ancestor
Requirement given below with scenarios:
Created a record 1 --> here Immediate Parent and Ancestor is blank.
Record 2 --> Immediate Parent is record 1 and Ancestor is Record 1
Record 3 --> Immediate Parent is record 2 and Ancestor is Record 1
Record 4 --> Immediate Parent is record 3 and Ancestor is Record 1
There is one more record say Record 5 (Immediate Parent and Ancestor is blank).
Now I change the immediate parent of 2 to 5 so the outcome should come like:
Record 2 --> Immediate Parent is record 5 and Ancestor is Record 5
Record 3 --> Immediate Parent is record 2 and Ancestor is Record 5
Record 4 --> Immediate Parent is record 3 and Ancestor is Record 5
How to acheive this in trigger?
Thanks,
Vai
I have a custom object which has 2 fields:
1. Immediate Parent (Self Relationship)
2. Ancestor
Requirement given below with scenarios:
Created a record 1 --> here Immediate Parent and Ancestor is blank.
Record 2 --> Immediate Parent is record 1 and Ancestor is Record 1
Record 3 --> Immediate Parent is record 2 and Ancestor is Record 1
Record 4 --> Immediate Parent is record 3 and Ancestor is Record 1
There is one more record say Record 5 (Immediate Parent and Ancestor is blank).
Now I change the immediate parent of 2 to 5 so the outcome should come like:
Record 2 --> Immediate Parent is record 5 and Ancestor is Record 5
Record 3 --> Immediate Parent is record 2 and Ancestor is Record 5
Record 4 --> Immediate Parent is record 3 and Ancestor is Record 5
How to acheive this in trigger?
Thanks,
Vai
Christan G 4
Before using code, please note that you can create records with the use of a process builder. I am not really following the requirement above. Please elaborate more on the conditions for when these events should occur.