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
CidCid 

Does a Upsert unintentionally invoke a trigger/workflow on a related Object?

Scenario:
We are using a BULK Upsert API call into the Opportunity object.  
Opportunity Workflow Rules are deactivated.
Account Workflow Rules are Active

Using the following fields to match and insert/update on External ID.

Opportunity.External_Id__c
Account.External_Id__c 

As you see in my Debug log below:  The workflow rules are firing, is that intentional?  I know I can add a custom setting or deactivate the workflow but I am looking for if anyone else has seen this before.


User-added image

Thanks in advance -- Cid

 
Udesh De SilvaUdesh De Silva
Workflow rules always fire if  they are active and match the critera. if you want there is option in import wizard to prevent workflow rules from firing

 
Amit Chaudhary 8Amit Chaudhary 8
Hi CID,

Yes workflow and trigger will fire for each DML opertaion. Actually upsert means Update and Insert . So according to the criteria rule done in workflow it will trigger the workflow if the condition is true.

Thanks
Amit Chaudhary
 
CidCid
Thanks Amit and Udesh.  To be clear, it is a Upsert to the Opportunity object with a lookup (reference) to the related Account record by AccountID:External_Id__c.  There is no update happening on the Account object, only the Upsert to the Opportunity record, yet the Account workflow rules are firing.  My impression is that a Upsert to a Object will invoke triggers and workflows to the related Lookup Object because it is querying for the Account by External_Id__c and linking the Opportunity record to the account, which looks like a behind-the-scene operation within Salesforce.  I can not find any documentation or reference to prove this theory.  Thanks for the feedback.