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

Salesforce trigger

Is there any way to identify if Salesforce update trigger is executed because of API action (mass load using data loader) or through Salesforce UI (user edit the record and saved it).
Please let me know if anybody already tried this.


This is not possible.

Shivanath DevnarayananShivanath Devnarayanan

I'm not sure if there is an explicit method to do this but a workaround for that would be if you could dedicate a User Licence just to do the Dataloading or the web API calls.


To make my self more clear, 


You should create a new user "webuser" or "datauser" something like that with the necessary permissions just for the API or Data Loading Jobs where you use this User Credentials, 


and in your Apex Code you could check which user is running the context , a snippet would be like 

if(UserInfo.getName() == 'DataUser')

 and run any code you need under that block.


hope that helps..

Mark it as solved if it did .. thank you