• Rajwant Saini
  • NEWBIE
  • 20 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 1
    Replies
I have a Before insert trigger on Contact class, which is calling a Future method from different class.
That future method calls a web url whch returns a value.
How do I take that returned value back to Trigger?

 
Hi Please help
I have a scheduled job which updates Accounts object data or insert new data in salesforce.
Also  I have a trigger which is AFTER INSERT and AFTER UPDATE on ACCOUNT object.

I do not want this trigger to fire when schedule job runs.
SO i did:

   if(!System.isScheduled()){    
    if (trigger.isUpdate){    
    Set<Id> setAccountNameChangedIds = new Set<id>();
        -------
         ---------
     }
  if (trigger.isInsert){    
         -------
          ------
     }
}

BUT my trigger is getting fired each time scheduled job runs.
Please help how do I stop the trigger to fire from scheduled job. I do not want to deactivate the trigger.

I just want it should not fire when scheduled job runs.

Please help!
 
I am new to this. please help me to write a test class of below trigger which should have 75% coverage please:

trigger AccountOperations on Account (after update) {    
      if (trigger.isUpdate){     
    Set<Id> setAccountNameChangedIds = new Set<id>();
        for (Account oAccount : trigger.new){
            Account oOldAccount = trigger.oldMap.get(oAccount.Id);        
            boolean bIsChanged = (oAccount.name != oOldAccount.Name);
             if(bIschanged){
                      Util.callWebService(oAccount.AccountNumber, oAccount.Name);          
     }     
            
      }
      }
}

}
I am new to this. please help me to write a test class of below trigger which should have 75% coverage please:

trigger AccountOperations on Account (after update) {    
      if (trigger.isUpdate){     
    Set<Id> setAccountNameChangedIds = new Set<id>();
        for (Account oAccount : trigger.new){
            Account oOldAccount = trigger.oldMap.get(oAccount.Id);        
            boolean bIsChanged = (oAccount.name != oOldAccount.Name);
             if(bIschanged){
                      Util.callWebService(oAccount.AccountNumber, oAccount.Name);          
     }     
            
      }
      }
}

}