You need to sign in to do that
Don't have an account?
yespee
Trigger do not fire on excel update
We have an after update and insert, trigger on Opportunities which fetches a valude from an account field and updates back on opportunity. It works perfectly fine when any opportunity recorde is created or updated from UI. However the trigger is not getting fired when an opportunity record is updated using excel connector.
Can some one please throw some light on this. Thanks.
This is quite odd. Can you post your code please?
J
trigger getDistiRegion on Opportunity (before insert, before update) { for (Opportunity oppty : trigger.new) { string rectype = [select id from RecordType where sobjecttype = 'opportunity' and Name='Design Opportunity' limit 1].id; string partnerid = oppty.PartnerAccountId; //check if partner is selected and Design oppotunity // Fetch partner region code from accounts try { if ((oppty.PartnerAccountId <> null) && (oppty.recordtypeid==rectype)) { string distiregion = [select Region_code__c from Account where id=:partnerid].Region_code__c; //update disti region code on oppotunity oppty.Distributor_Region__c=distiregion; } } catch (dmlexception e) { system.debug('caught exception' + oppty.id);} } }
does your debug log contain an output from the catch() when the trigger fails?
or do you think it is never called ?
you can find out by placing a debug statement in the trigger, outside the loop. then run the update and observe the debug logs to verify that it is called.
then you can add more debug statements to see where this code is going.
note, you query the record type for each record ( inside the loop) when you only really need this done once.
Correct. Excel sheet have Opportunity information with opportunity IDs as well as valid accounts ids for 'partnerid'.
Also I will get back with debug log as suggested by Ron. Thank.