REQUIREMENT
I am trying to override the Automated Process user with another user for a platform event.
SOLUTION
There is a solution is Salesforce, Salesforce documentation says:
In accordance with the second article, we can try to accomplish the goal by:
- Deploying a component containing configurations for my platform-event trigger: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_platformeventsubscriberconfig.htm
- Use Tooling API to update it!: https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/tooling_api_objects_platformeventsubscriberconfig.htm
In this example, I am gonna explain the second approach, the first approach is honestly time taking and fails a lot without knowing more details.
Use Tooling API to update
POST /services/data/v64.0/tooling/sobjects/PlatformEventSubscriberConfig
{ "BatchSize": "2000", "DeveloperName":"StripeIntegrationTrigger", "MasterLabel":"StripeIntegrationTriggerConfig", "PlatformEventConsumerId": "01qGH000005VGbt",//trigger id developed on platform event "UserId": "005LO00000RybtJ" // update the Id of user that you want as "Run As" user. }