function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
guenthmnguenthmn 

How to figure out in a trigger if the the information is entered via the UI or API?

I looked at useing the Trigger.isApi() call as well as Trigger.isUI(), but the Trigger compiler does not appear to understand these two methods/Fields (booleans?).

 

I simply want a field/property I can query to tell me who is the author:  UI or external process.

 

Can someone provide a hint on how to figure out in a trigger if the the information is entered via the UI or API 

 

Thanks,

 

Matt 

JimRaeJimRae

I don't believe either of these methods you mention exist, at least, I can not find them in the documentation.

The only way I have figured out to cover this is to add a field to the object for tracking this.  Set a default value for it on the page layout, (this would be UI) and when you do DML on records via Apex, set it to a different value. Then your trigger can look at that field and you can take the appropriate action.