I have a trigger/classes in place that follows a record for a Community user. I am doing this by inserting a new EntitySubscription record. My code is working great for Admin users. However, when a non-admin user initiates the trigger/class, I receive the error:
System.DmlException: Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id
I believe the root cause of this error is limitations on the EntitySubscription object. From the official documentation:
Administrators and users with the “Modify All Users” permission can configure a user to follow records that the user has read access to.
I take this to mean that users cannot follow records for other users, unless they have the “Modify All Users” permission, which would explain the error I am seeing.
Has anyone ran into this issue before or have any workarounds for this? Thanks in advance for your assistance.