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
JoshAdvantixJoshAdvantix 

Workflow triggering when we associate a new contactid via the API

Any help on this would be appreciated...

We have developed some code (C#) that utilizes the API to associate a new ContactId to a case which already exists in our Salesforce instance.

The following is the debug information from SF (snippet) of the specific workflow that correctly DOES NOT trigger when I saved in the browser but DOES trigger when the save is made in the API.

DEBUG LANGUAGE (snippet) WHEN SAVE MADE FROM API - changing contact was not a triggering update, so we're guessing it somehow thinks this was freshly created as a case - even though it already existed
-------------------------------------------------
Rule Name: Client - BB Activation
Trigger type: ON_CREATE_OR_TRIGGERING_UPDATE
Evaluating Workflow Entry Criteria:
[Case : Case Record Type equals 1-ADMIN-Activation (New Equipment)]
AND [Account : Account Name equals XXXXXX Energy]
AND [Case : New Equipment Phone Number not equal to null]
AND [Case : Equipment Type equals PDA - Other, PDA - Windows Mobile, Blackberry, PDA - Palm]
AND [Case : Date/Time Opened greater than Fri Jun 08 05:00:00 GMT 2007]
Value found: 012300000004rrP
Value found: XXXXXX Energy
Value found: (512) 555-1212
Value found: 2
Value found: 2008-09-09 19:14:19
Criteria evaluates to true
[Case: 00073545 500S0000000nW9A]


DEBUG LANGUAGE (snippet) WHEN SAVE MADE FROM BROWSER - as you can see, it did not execute because there was no triggering update or create
-------------------------------------------------
Rule Name: Client - BB Activation
Trigger type: ON_CREATE_OR_TRIGGERING_UPDATE
Evaluating Workflow Entry Criteria:
Rule not evaluated
[Case: 00073545 500S0000000nW9A]

Thanks!
Josh
sfdcfoxsfdcfox
ON_CREATE_OR_TRIGGERING_UPDATE means that the criteria must not be true before the record is modified (unless a new record is being created). This is a "rising trigger", meaning it only triggers when the condition changes from false to true, not when it stays true to true or false to false, or goes from true to false. Try changing the rule to "outside" the criteria (make the record not match the criteria), then change it back "inside" the criteria (make the record match the criteria); and you will see that the rule will work correctly. It may be that you want to use the "Every time a record is created or edited option" and using "ISCHANGED()" to precisely trigger the workflow rule when you need to.