+ Start a Discussion
MNRobMNRob 

Informatica data load doesn't fire trigger on Account

I am uploading some data into custom fields to the account object using infromatica. It works great.

 

I added a trigger the is supposed to calculate the Gp Per Load when Gp or load count is updated. This works great when updating via the UI (only the administrator has rights through the UI).

 

However the trigger does not appear to fire when the data is updated/inserting from infromatica? Any thoughts?


Below is the trigger. Any help is greatly appreciated.

 

trigger updateGPPerLoadMTD on Account(before insert, before Update) {
Account newAccount= trigger.new[0];
Account oldAccount= trigger.old[0];


integer descLength;

if ((newAccount.Loads_Current_Month__c != oldAccount.Loads_Current_Month__c  ||
     newAccount.GP_Current_Month__c != oldAccount.GP_Current_Month__c ) && newAccount.Loads_Current_Month__c > 0 ) {
     newAccount.GP_Load_MTD__c = newAccount.GP_Current_Month__c /  newAccount.Loads_Current_Month__c; 
}

If (newAccount.Loads_Current_Month__c == 0){
    newAccount.GP_Load_MTD__c = 0;
}
}

Best Answer chosen by Admin (Salesforce Developers) 
MNRobMNRob

Makes sense.

 

Thanks Simon! 

All Answers

SuperfellSuperfell
Your trigger assumes there's only a single account being processed, which is true for the UI, but not true anywhere else including the API, you need to update your trigger to process all the accounts in the trigger.new array, not just the first one.
MNRobMNRob

Makes sense.

 

Thanks Simon! 

This was selected as the best answer