Salesforce Fact #387 | Screen flow and subflow exceution contexts

Let's see what are the possible contexts on how we can launch a screen flow or autolaunched flow. So there are 3 options available:

1) User or System Context-Depends on How Flow is launched

2) System Context with Sharing-Enforces Record-Level Access

3) System Context Without Sharing-Access All Data

Now, suppose we have a main flow and a subflow with the context set for each of them. In this example, we have a main flow which is invoking an auto-launched flow which is fetching the account records. In the main flow, finally we are showing the count of fetched records.

                                     Main flow

 Sub flow


Let's see what are the possible scenarios.

When the main flow context is System Context Without Sharing-Access All Data and subflow context is User or System Context-Depends on How Flow is launched, then the auto-launched flow takes the context of main flow and can access all the records.




When the main flow context is System Context Without Sharing-Access All Data and subflow context is System Context with Sharing-Enforces Record-Level Access, then if the mainflow is launched as a user the records will be fetched ensuring the record level access.





When the main flow context is System Context with Sharing-Enforces Record-Level Access and subflow context is System Context Without Sharing-Access All Data, then if the mainflow is launched as a user, the subflow would still fetch all the records. It is like extending the access level, although a warning is shown while saving the main flow.






When the main flow context is System Context with Sharing-Enforces Record-Level Access and subflow context is User or System Context-Depends on How Flow is launched, then the records in subflow will be fetched ensuring the record level access for the user.
















Comments

Popular posts from this blog

Salesforce Fact #192 | Call batch apex from flow

Salesforce Fact #457 | Get current user role name in flow