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
CRNRCRNR 

Trigger to exclude a field from checking for modification?

We are integrating our ASP.NET applications with SF and the ASP.NET application is going to check to see if there are records in SF product table that have been modified and if so then update our database. We have created a workflow rule that sets "isUpdate" checkbox field if anything is updated on the record(s). Then our other application is setup to set the "isUpdate" to false after it comes through. The problem is that by virtual of changing "isUpdate" to false it is modifying the record and thus triggering our workflow rule again and setting it to true. We tried to handle it with an apex trigger but still were not able to get the logic right.

 

Any ideas?

 

 

trigger NRisUpdate on NRProducts__c (before update) {
    for (NRProducts__c r: Trigger.new) {
        NRProducts__c oldCase = Trigger.oldMap.get(r.ID);
       if (r.isUpdate__c != oldCase.isUpdate__c) {
       	       	if(oldCase.isUpdate__c == false){
            r.isUpdate__c = false;
        }
    }
}
}

 

 

_Prasu__Prasu_

You will just need to correct the workflow firing conditions. I guess you are using "whenever record is created or updated" and that is causing the problem.