+ Start a Discussion
Dr. Thomas MillerDr. Thomas Miller 

Flow / CreateRecords behaves differently for administrator


I have a flow which first creates a custom record A, then creates a second record B which contains a lookup to the first record.

When I run this flow as administrator, everything is fine. When I run it as a normal user, I get an INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY  error.

When I place a screen between the two Create Record elements the flow runs fine even for the normal user.

 

Debugging the flow shows that the ID of A is available directly after the first Create Records - but the debugger also tells me that A will only be created after the next pause. So it seems that the lookup from B to A is only possible after the screen pauses the flow and A is truely written to the database.

But why is this different when I run the flow as an admin?
Two ideas:
I) there is a trigger on A that changes the owner and the normal user's access is through a sharing rule. That rule might be applied delayed or even asynchronously. That however would make the flow outcome indeterminate
Ii) Some optimization in the flow engine delays DML execution. Text in the debugging screens indicates this. However this would not explain why the behaviour is user specific.