Document Roles
Document Roles (mvn__CM_Document_Role__c) manage the list of users or
groups and their associated Role(s) for a document. Document Roles can
be assigned manually via the Sharing tab of a document record or
automatically through workflows. For a list of Document Role fields,
visit Document Role.
Document Role assignment
Document Roles are assigned in three ways:
-
Manually via the Sharing tab on a document record
-
Automatically via workflows
-
Automatically via Document Sharing Rules
Note: Document Roles cannot be assigned to inactive users, and the Document Roles assigned to users while they are active are removed from those users when they become inactive.
Manual assignment
To manually assign a Document Role:
Note: To manually share a document, you must have the Manage Sharing permission for that Document. Visit Document permissions.
-
Navigate to the Sharing tab on a Document's Detail Page.
-
Click New.
-
Search for and select a User or Document Group.
-
Select a Role to assign to the User or Document Group.
-
Click Save.
Automatic assignment via workflows
When users are assigned Workflow Activities, automatically adds those
users to the Document Role according to the nature of the activity. For
example, when a user is assigned a Task with the Record Type
CM_General, assigns that user the "Reviewer" Document Role. When a
user is assigned a Task with the Record Type CM_Approval, assigns that
user the Approver Document Role. Visit
Workflows.
Note: By default, does not automatically remove Document Roles when workflow tasks associated to the Role are closed. To enable strict document role assignments, set
mvn__CM_Global_Setting__mdt.mvn__CM_Strict_Document_Roles__ctotrue.
Automatic assignment via Document Sharing Rules
With Document Sharing Rules, the criteria you set determines whether a role(s) has access to a document. Upon creation of a document, evaluates all Document Sharing Rules. If a Document Sharing Rule evaluates to true for the document, inserts the associated role(s) for that Document Sharing Rule into the document's Document Roles database table and grants associated groups access to the document. Groups are associated with Document Sharing Rules through Document Sharing Rule Groups. The Document Roles table determines what users can see and do as a document goes through its lifecycle. This means that when a document's state changes, the permissions for each Document Role are recalculated.
For more information, visit Document Sharing Rule Groups.
Recalculate sharing
You can use either the mvn.CM_DocumentSharingService class, the
mvn.CM_RecalculateSharingBatch class, or the
mvn.CM_CreateDocumentSharingRulesBatch class to recalculate sharing on
documents in your environment. Sharing recalculation is performed by
deleting mvn__CM_Document_Role_Share__c records and then
recreating mvn__CM_Document_Role_Share__c records for a list
of mvn__CM_Document_Role__c records. Both existing and new sharing
rules will be applied.
To recalculate sharing:
-
Open an Execute Anonymous Window. Visit Salesforce's documentation.
-
In the Execute Anonymous Window, enter the code for one of these options:
-
Recalculate sharing for the list of
mvn__CM_Document_Role__crecords:mvn.CM_DocumentSharingService.recalculateSharing(List<mvn__CM_Document_Role__c> documentRoles)
-
Recalculate sharing for a set of
mvn__CM_Document__crecord IDs:mvn.CM_DocumentSharingService.recalculateSharing(Set<Id> documentIds)
-
Recalculate sharing for all
mvn__CM_Document__crecords without accounting for groups::Database.executeBatch(new mvn.CM_RecalculateSharingBatch(), <batch size>);
-
Recalculate sharing for all
mvn__CM_Document__crecords while taking into account of groups. For more information about document sharing rules for groups, reference Document Sharing Rule Groups.Database.executeBatch(new mvn.CM_CreateDocumentSharingRulesBatch());
-
-
Click Execute.
Document ownership
Only a single owner can be tied to a document. Transferring document
ownership updates the CM_Owner role and updates the Salesforce Owner
for the Document, Document Version, open and completed Workflows, and
Document Relationship records owned by the previous owner.
Note: Only the current document owner or users with
mvn__CM_Adminpermission can transfer ownership.
Deleting document roles
By default, a document role can only be deleted from a user if the user
does not have any open workflow tasks on the document that are
associated with the document role. However, if you have the CM Delete
Document Role With Open Tasks
(CM_Delete_Document_Role_With_Open_Tasks) custom permission, you can
delete any document role from any user regardless of what open tasks the
document role may be associated with.
To remove a document role from a user, excluding the Owner role:
-
In the Document Roles component, click the down arrow to the right of the user whose document role is to be removed.
-
In the dropdown menu, select Delete.
-
In the Delete Document Role confirmation modal, click Delete.
To remove the Owner role from a user, you must transfer the ownership to another user because every document must have exactly one owner. For more information about document ownership, reference the Document ownership section above.
To transfer the Owner document role to another user:
-
In the Document Roles component, click the down arrow to the right of the user who has the Owner role.
-
In the dropdown menu, select Transfer Ownership.
Document roles can also be automatically removed if a user completes the
task that was assigned to them because of their role. To configure this,
check the Strict Document Roles (mvn__CM_Strict_Document_Roles__c)
field on the Default (CM_Default) metadata record of the
MCM Global Setting
(mvn__CM_Global_Setting__mdt) custom metadata type.