2

I have a scheduled flow that calls an Apex Class. This class mainly identifies certain records and, if they are "pending" in an approval process, it recalls them and updates some fields.

The process works just fine, but as the setAction('Removed') function only works when launched by an Admin, I need to know if scheduled flows run in admin context or not.

As it is an automated flow launched every night, I suppose it does, but I cannot find the answer in the flow docs.

Thanx a lot.

4
  • As far as I'm aware, flow runs in user mode. – Rohit Mourya Dec 30 '19 at 11:59
  • But, what user is considered as the "launcher" in a scheduled flow? – Nadine Thery Dec 30 '19 at 12:07
  • @NandireThery The one who scheduled the flow – Rohit Mourya Jan 1 '20 at 16:37
  • 1
    Hi Rohit, yes it does in general terms. Howevers, I found out (see my answer below) that autoflows with no screens always run in system environment. Thank you for your quick response. – Nadine Thery Jan 2 '20 at 8:36
6

It apparently runs as the "Automated Process" user.

I see mention of it here https://jenwlee.com/2019/10/01/schedule-a-flow/

enter image description here


More importantly, I scheduled a quick flow to test this and I can see through debug logs that the scheduled flow was executed by the Automated Process User as opposed to the user who scheduled it.

Scheduled Jobs enter image description here

Debug Logs enter image description here

1
  • Thank you it was useful for putting me in the right way to make the correct questions. As I found out later, automated flows with no screens run in system context. – Nadine Thery Jan 2 '20 at 8:37
2

Thank you all for putting me in the right direction.

I made some more research and found out that as @KrisGonsalvez says, the flow runs as an Automated Process user. And as I could find out in the post I mention below, is that autoflows always run in System Context. So it's kind of a way of bypassing the permissions limitations.

How to By-pass User Permissions With Flow

Nine Tips for using Lightning Flow the right way

0

Be aware that in the Spring ‘20 release, will be able to choose what the flow runs as:

https://releasenotes.docs.salesforce.com/en-us/spring20/release-notes/rn_forcecom_flow_fbuilder_system_mode.htm

1
  • Great, thank you for letting me know about this, I will keep track of the following updates. – Nadine Thery Jan 2 '20 at 8:27

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.