I have written one trigger which fires on account create and update,but there is one API which creates/update account and if creation/updation is through that API i don't need to fire trigger. Please suggest how can i achieve this.


One option is to have a field (Say origin type picklist) on respective object(in your case it is Account).

This field would have several values like created through code OR created through API OR created manually .

And in your trigger you would check for this field. So if the origin of the record is through API you won't perform the operations in the trigger.

  • but how to update that field value as this API ,we cannot make any changes in that API class – sudhanshu Oct 15 '18 at 8:55
  • @sam You would need to figure out what unique thing this API is doing, for example maybe it is updating some field which only this API updates, on the basis of that you can discover the origin of the record. – Mr.Frodo Oct 15 '18 at 8:58
  • that also we are not sure the field which will update/create.any other solution – sudhanshu Oct 15 '18 at 9:22
  • @sam It is really hard to track from your side if you can't change the API code. Maybe you can contact to vendor (Who write the API code) to provide some mechanism. – Mr.Frodo Oct 15 '18 at 9:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.