4

I have a flow that is set "Runs as System". As per the documentation, this means that the flow:

has permission to access and modify all data

However, this doesn't appear to be the case.

This "Runs as System" flow is part of a no-namespace 2GP unlocked package and is used on an Experience Builder Site page from that package. It first uses a screen to request the user to select from a list of available Job Types (an object type from a dependency 1GP). Using the selected Job Type it then performs a Get Records to find records of a separate object type (Competency Condition, also from the dependency 1GP) that have a lookup to the selected Job Type record. See the following snippet:

Initial part of the flow

It is at this point that the flow was failing; the Get Records element was not finding any Competency Condition records, even though there were several matching the selected Job Type available in the database.

After some investigation, I visited the Sharing Settings to look at the OWDs and saw that, while the external sharing for Job Type was "Public Read Only", the external sharing for Competency Condition was Private. After making this "Public Read Only", the flow's Get Records started to find the Competency Condition records matching the selected Job Type record.

Given the stated behaviour, from the above cited documentation, that the flow can "access and modify all data", why does the flow not actually get access to all data but still applies the external sharing model OWDs?

1
  • 2
    Could you add which type of "Runs as System" this flow is using? There are two types: "System Context with Sharing" that enforces record level access and "System Context without Sharing" that doesn't. Sounds like its using the former but isn't clear from the screenshots/description.
    – Jeff Kranz
    Jul 16, 2021 at 13:13

2 Answers 2

3

As @Jeff Kranz pointed out in his comment, flows support one of two "Runs as System" options; one that considers sharing and one that does not. Oddly I don't recall seeing two options when I originally defined this flow, but I guess it was there. I have it set to the wrong value.

The solution, therefore, is to make sure that sharing is turned off too by selecting "System Context Without Sharing":

Advanced version properties showing run as system choices

Thanks Jeff!

2

To explain why you might not have noticed the option, the ability to run with or without sharing actually came in sequential releases.

In Spring '20, the ability to run flows in System context with Sharing.

In Summer '20, the ability to run flows in System context without Sharing.

So, as you noted, you most likely selected the System context with Sharing as that was the only option at the time for running in system context.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .