We have a bunch of case assignment rules in our system. Most Cases are created via an integration with an external web form, but some Cases are manually entered by Users in Salesforce (these are the ones we're having issues with). The Case OWD is Private, with access being granted via Owner-Based Sharing Rules & Role Hierarchy.
Some users are getting this error when they try to create a Case:
"We hit a snag. You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary"
I've checked the object and field permissions and everything is correct. Furthermore, the error doesn't appear every time a User creates a Case, which indicates that this is related to record-access rather than object/field access. The error only seems to appear under these 2 scenarios:
- The Case being created will be assigned to a Queue which the creator is not a member of
- The Case being created will be assigned to the default Case Owner (a system admin at the top of the role hierarchy, so the User won't have permission to see this Case)
Based on these 2 scenarios, it seems like a User cannot create a Case if the assignment rules that fire afterwards are going to cause the creator to lose access to it entirely. Is that expected??
I was under the impression that the Case Assignment Rules run AFTER the User's permissions are validated for creating the record, therefore it is always feasible that a User can create a Case regardless of whether they can view it or not after the assignment rules run. So I guess a more general question is, when does record access get checked in the order of execution? The salesforce documentation is vague about this.
Lastly, if this is a known limitation in how permissions work with Case Assignment rules, would a suitable solution be to simply write a BeforeInsert trigger to set the Owner = a system admin User, so that the Assignment Rules can run without hitting any permission errors?