You need to sign in to do that
Don't have an account?
rusty_
Creating a trigger that updates a field in the detail of a master detail relationship
I am trying to create a trigger that updates a field in the detail of a master detail relationship.
For example...
I have a custom object called Risk and I have a junction object called Risk Relationship.
Risk Relationship is connected to Risk by a Master Detail relationship and a lookup relationship as well.
Risk Relationship is the detail in both relationships.
Is it possible to create a trigger so that whenever a Risk is edited, a trigger is fired to create a field update in the Risk Relationship custom object?
Is that possible?
If Risk is the Master and Risk Relationship is the detail, could you not use a formula field instead?
Yes. Add a Trigger on the Risk object (after update). That will fire anytime you update one or more Risk objects.
pseudo-code:
Here is what I did so far
It is giving me this error.
Also, what do you mean by the section below? I want it to update the child record all the time.
Sorry, I am still new to this. This is my first trigger that I am creating. I am probably going to be taking DEV501 in April to help me out with this.
This is the new edited code but it is still not working...
Error: Compile Error: Variable does not exist: rr at line 15 column 11
This is the new code...
it saves it but when I try to test it I get this error.
Error:Apex trigger updateRiskRelationshipDefinition caused an unexpected exception, contact your administrator: updateRiskRelationshipDefinition: execution of AfterUpdate caused by: System.NullPointerException: Attempt to de-reference a null object: Trigger.updateRiskRelationshipDefinition: line 12, column 56
Can anyone help?