You need to sign in to do that
Don't have an account?
CKR
Need help for the trigger
Hi,
could someone help me,how to write the trigger based on the following scenario,
for instance, i have a custom field called status (picklist with values 'open' 'Closed') on both Account and opportunity objects,
now if an account has 4 related opportunities with 2 of them with status as 'open' and other 2 as closed,lets say, if an account's status is 'open' along with any of its related opportutnities as 'open', then a custom error has to be thrown if any user try to change the status of the Account from Open to close.
could someone help me,how to write the trigger based on the following scenario,
for instance, i have a custom field called status (picklist with values 'open' 'Closed') on both Account and opportunity objects,
now if an account has 4 related opportunities with 2 of them with status as 'open' and other 2 as closed,lets say, if an account's status is 'open' along with any of its related opportutnities as 'open', then a custom error has to be thrown if any user try to change the status of the Account from Open to close.
You should also probably handle the before insert case as well, not just the before update case?
Note that you should also write a trigger on the opportunity as well in case someone changes the opportunity status from Closed to Open and validates the above rule.
Hope that helps!
All Answers
Hope that helps!
This is what my trigger looks like so far,,it is not working as expected yet..
You should also probably handle the before insert case as well, not just the before update case?
Note that you should also write a trigger on the opportunity as well in case someone changes the opportunity status from Closed to Open and validates the above rule.
Hope that helps!
Thanks for the help it worked,perfect!, even i made some progress on my trigger on that night,the way you have written the trigger is little different in the way that i have written but your trigger looks efficient, below is the trigger that i have bettered, please feel free to provide your inputs on my trigger,hoping that would help me make more sense on the triggers topic.