You need to sign in to do that
Don't have an account?
Serghei Sleptov
Trigger that fires on Account change
I need a trigger that if there is a change on Account record gets all the Opportunities and Opportunity Products belong to that Account refreshed (edit and saved) using the updated information from parent Account record.
Can anybody advise?
Thank you,
Serghei
Can anybody advise?
Thank you,
Serghei
All Answers
Below is an example of trigger to update related Opportunities based on Account changes.Update this trigger based on your business need.
This should do it - keep in mind limits though.
Hi, mjohnson-TIC,
Thanks for your help, however it failed with the following error:
# Deploy Results:
File Name: triggers/AccountTrigger.trigger
Full Name: AccountTrigger
Action: NO ACTION
Result: FAILED
Problem: DML requires SObject or SObject list type: LIST<Id>
Perfect!
can you also help me to build Test coverage on that trigger?
Thank you
Thanks. mjohnson-TIC,
however it gave me an error:
Insert failed. First exception on row 0;
first error: STANDARD_PRICE_NOT_DEFINED, No standard price defined for this product
Can you tell me how I can set STANDARD_PRICE in test ?
Thank you
Thank you!
it is working now!
One more question: in the trigger if I want to monitor 2 fields change : Parent Account and/or another custom field, I think Ishould modify this line?
can you help me with correct syntax?
if(trigger.old[i].Total_All_Number_Fields__c != trigger.new[i].Total_All_Number_Fields__c){
al.add(trigger.new[i].Id);
if(trigger.old[i].Field1 != trigger.new[i].Field1 || trigger.old[i].Field2 != trigger.new[i].Field2){
Perfect!
Thanks a million!!!