I want to execute different logic in an update Trigger, depending on whether the Trigger was invoked by an operation through:
- a Visualforce page
vs. others like
- standard Page Layout
- external application using the API
- future calls or scheduled Apex.
Is there any way to check whether we initially entered the current Execution Context by an operation through a particular Visualforce page.
The Visualforce page is part of a third party Managed Package, so I can’t access the code.
System.currentPageReference()– What is the current page? It will most likely be null for the external API.
System.isBatch()– Is the code currently executing inside a batch Apex job?
System.isFuture()– Is the code currently executing inside a method annotated with future (or being called by it)?
System.isScheduled()– In the code currently being executed inside a scheduled Apex job?