function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
yespeeyespee 

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. 

dev_jhdev_jh

This is quite odd. Can you post your code please?

 

J

yespeeyespee

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);} } }

 

Ron HessRon Hess

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.

dev_jhdev_jh
Silly question: when using Excel Connector I assume you have an .XLS with Opportunities and valid Account IDs pointing to accounts with a specified region and not an Account Name. Correct?
yespeeyespee

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.

AtanguduAtangudu
Same happen in  my case. I update a field on OpportunityLineItem using excel connector. which fires trigger to update another field on the opportunity LineItem, which didn't happen.