We are implementing Communities in our project and as part of its functionality, the community user submits a form and as a result of this submission:
- An Account record needs to be created
- Account Ownership should be changed from Community User to a different user
- The community User should regain access to the same Account but with just Read access.
The Account record creation happens in apex code. On Account object, we have a process builder with an action that changes OwnerId to different user id and another action in the same process builder to call a Flow to insert Account share record for the community user to get read access to the account.
But when the community user is submitting the form, the following exception is thrown:
This error occurred when the flow tried to create records: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY: insufficient access rights on cross-reference id.
OWD Sharing : Default Internal Access is Public Read Only and Default External Access is Private. Flow is set to run in System Context.
Please let us know if we are missing something here.
Thanks. [Edited]