[SalesForce] Can you run a Batchable Apex bulk update as a different user

I have been running my Batchable Apex bulk update from the developer console so it runs with my permissions. Is it possible to run it as another user? Ideally I'd like to run it under the API profile because our validations rules are set up to ignore updates from this profile.

Best Answer

AFAIK, the only way to accomplish this would be to log in as the API user, or whatever user you want the class to run as, and then either schedule or execute the batch class.

There is nothing like a RunAs() that you can use in testing code.

Related Topic