Is it possible to get the way a method is called in Apex? In my case, I need to determine how a trigger fires: if its called from a external API (jsForce) or if a user deletes a record through the normal Salesforce UI.

I know all of this can be monitored but I need the context in my Apex Trigger Handler.


Triggers run at the database layer and hence are agnostic about how invoked. Options to distinguish external API from run of the mill UI operation:

  • ExternalAPI uses a specific userName as context user
  • ExternalAPI uses a user assigned a specific custom permission

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.