You need to sign in to do that
Don't have an account?
Sandra O
Help with trigger - only updates after edit/save
I have a trigger on the Account - I am trying to trigger an upadte on the Account to do an update on related Integration Account records. However, the update is only applied after I do an edit/save on indivudual Interation Account records.
this is what I have so far:
this is what I have so far:
trigger UpdateIA on Account (after update) { Integer index = 0; for(Account acc : Trigger.New) { //Check entry criteria if(acc.Complexity__c != Trigger.Old[index].Complexity__c) { List<Integration_Account__c> listIA = [Select Complexity_roll_up__c from Integration_Account__c where Integration_Account__c.Account_ID__c =: acc.id]; for(Integration_Account__c ia : listIA) { ia.Complexity_Roll_Up__c = acc.Complexity__c; } update listIA; } index++; } }
I was able to accomplish this functionality with Flow and a Flow trigger. THanks for you assistance.
All Answers
Since we have governer limits in salesforce, we shouldn't write soql queries inside FOR loops. I have updated your trigger, you can use this.
Best Regards,
Mithun.
THank you for your help! I am getting the following error:
[Error] Error: Compile Error: unexpected token: 'Map' at line 5 column 4
Sorry, we had missed the "New" keyword in map definition. Here is the updated one.
Best Regards,
Mithun.
This is working - but its only updating after a update an individual Integration account record and hit edit/make no changes/save.
I was able to accomplish this functionality with Flow and a Flow trigger. THanks for you assistance.