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 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, Scientific Publications Cloud product 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 the CM_DocumentSharingService class,
the CM_RecalculateSharingBatch class, or the
CM_CreateDocumentSharingRulesBatch class to recalculate sharing on
documents in your environment. Sharing recalculation is performed by
deleting CM_Document_Role_Share__c records and then
recreating CM_Document_Role_Share__c records for a list
of 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 a list of
CM_Document_Role__crecords:CM_DocumentSharingService.recalculateSharing(List\<CM_Document_Role__c\> documentRoles) -
Recalculate sharing for a set of
CM_Document__crecord IDs:CM_DocumentSharingService.recalculateSharing(Set\<Id\> documentIds) -
Recalculate sharing for all
CM_Document__crecords without accounting for groups:Database.executeBatch(new mvn.CM_RecalculateSharingBatch(), \<batch size\>); -
Recalculate sharing for all
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 CM_CreateDocumentSharingRulesBatch());
-
-
Click Execute.
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. For more information, reference
Remove document role.
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.