0

I'm trying to run a flow action to sync records to sage - it works great but if the user isn't mapped in Sage it fails as they aren't mapped.

I had the idea to run the flow as our API User, which is mapped and should never fail, but I can't find an easy way to do it. I just want it so that when any user triggers the flow, it runs the sync action as the API user in the background.

Is this even possible?

1
  • 2
    runAs only works for testmethods
    – cropredy
    Nov 3 '20 at 17:47
1

You can't get the Flow to execute as another User. You can make it run in system context in terms of Permissions and Level of access to Fields and Records, but you can't make it "impersonate" a User.

If you don't mind a "not very nice" solution, you could condition your Flow on a specific field change, and then do the field change using a Time Based Workflow with a Field Update action. The trigger could be 0 hrs from Rule Triggered date and should fire in minutes in the worst case. Time Based Workflow Actions run in the context of a selected Workflow user (Setup > Process AutomationSettings).

Note that Time Triggers in Process Builder won't help you as those fire in the context of the user who caused them to schedule.

A better (or more correct) solution though would be to ask how exactly is the sync working. Is it an App with some config or some custom code or what? Maybe there is a way to configure it to always connect with a specific user context? Like e.g. if it were some custom Apex Callout using Named Credentials, you could specify the same credentials for everyone.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.