+ Start a Discussion
Nora Nicklis 32Nora Nicklis 32 

Flow not properly running in system mode despite setting

I have created a flow that is set to run in system mode (System context without sharing).
Based on the documentation, this is supposed to ignore all object permissions.

The flow I have built is meant to create a record of an object that certain profiles don't have the create permission for. I assumed that, if I run the flow in system context this wouldn't cause issues for these profiles. But it does. All profiles that don't have create permissions for that object get an error when they launch the flow. When I change the profile it works fine.

To me that sounds like the behavior of the flow is different from what the documentation describes.

Does anybody have an idea on how to handle that? I tried opening a case with SF but it is considered a development case which is not covered by our support package so I was advised to post the question here. 
ShirishaShirisha (Salesforce Developers) 
Hi Nora,

Greetings!

By default,the screen flow runs in uder mode but when you launch a Flow using the Process Builder, then it will run in system mode.If you run the flow in "System Context Without Sharing-Access All Data" then this should not cause any errors if the profile doesn't have any required permissions.

Please refer the sample flow which will be created to run in System Context without sharing:

https://automationchampion.com/tag/run-a-flow-in-system-mode/

Kindly mark it as best answer if it helps so that it can help others in the future.

Warm Regards,
Shirisha Pathuri
Craig WoodmanCraig Woodman
I agree on this. Check your profiles to make certain that they have field access for each of the fields as well. I have run into that as a problem before - when one field is not accessible.
Nora Nicklis 32Nora Nicklis 32
Thanks for the feedback. 

Let me clarify a little bit. 
The flow built is a screen flow, which I know runs in user mode by default, but I went into the flow settings to change it to run in system mode. 
Here's a screenshot of the setting. 

User-added image

But even with this setting, when users with a specific profile run it, they get an error due to object restrictions. 

@Craig: The way I understand system mode is that, in that case, I don't need to worry about any object/field permissions. Is that incorrect? 
Filipe CarreiraFilipe Carreira
I'm experiencing the same problem. Did you ever determine what was the cause? 
Richard FleckRichard Fleck
Looks like it's a bug in Flow API Version No. 52. It works fine for me in v51.
Pete Fife 16Pete Fife 16
I'm running across this as well, where the flow is set to System Context Without Sharing - Access All data, and if I run this with a user that doesn't have permissions to the object, which is what we want, but the flow should bypass this security setup in this specific context, however it doesn't. 

During the debug process I can set who to run the as and if I select the normal user, we get an error. If I select myself or an adming the flow runs.

Doesn't seem to matter of the API version, I've tried 53, down to 50. 
Ruth RushtonRuth Rushton
I'm also having this same issue, and annoyingly when I run it in Sandbox as the specified user, it works perfectly, but the user is not able to use the Flow correctly in Production.
Ryan Posthumus 11Ryan Posthumus 11
I started getting this same error when trying to run a flow that updates the Event -> Description field in the system context.  In all my testing, and even after it was moved to production it was working fine.  But now users are getting an error they don't have permission to make edits, despite the flow being System Context-Access all data as described before.  I also change the flow version to see if that would resolve the issue but it did not. 

Has anyone got this to work?
 
פנינה רבינסקיפנינה רבינסקי
HI somone solved that issue?
Im also runing flow as system and still getting permmission error 
any workarond??
Smriti Singh 7Smriti Singh 7
Error : An unhandled error has been occured in the flow.

Try the below setting to resolve the ablove issue - 
Setup->Create-> Workflows and Approvals -> Process Automation Settings
and set checkbox Enable record locking and unlocking in Apex as true
saarikogmailsaarikogmail

I got the same behaviour in API 55.

My workaround was to give the 'view all data', definitly not ideal, but since it was given in a permission set, it's a lesser of an issue.