+ Start a Discussion

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;




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.