To work with case roles, you should use the CaseRoleService service. You can see a list of methods in the interface and in the JS implementation of CaseRoleServiceJS. In the javascript context, this service is available by the name "caseRoleService". The Javascript implementation as role representatives can receive the Authority Name, ScriptNode or NodeRef.

Registered policy

  • OnRoleAssigneesChangedPolicy

void onRoleAssigneesChanged(NodeRef roleRef, Set<NodeRef> added, Set<NodeRef> removed);

Called when role representatives are alterable. Among the parameters are a link to the role, a list of added representatives, and a list of remote representatives. All parameters are unequal to null, and collections must be unchangeable.

  • OnCaseRolesAssigneesChangedPolicy

void onCaseRolesAssigneesChanged(NodeRef caseRef);

Called when any roles representatives in the case are alterable. This event is convenient when you need to make a general action for all changed case roles, and creation of the new one at every onRoleAssigneesChanged call can be costly.

Role forms

  • A standard role (icaseRole: role) is a role which representatives are selected by the case editor manually or through external influence (for example, with the js action that adds a person to the role).
  • Javascript role (icaseRole: scriptRole) a role whose representatives are evaluated by execution of a javascript The return value can be either NodeRef, Authority Name, ScriptNode, or an array containing any of the values ​​mentioned. The level of arrays nesting is not important. All unique elements are selected from the returned value and assigned to the role. If one of the array values ​​is null or undefined, then this value is ignored. In the script context the following objects are available: document - ScriptNode of the cas, role - ScriptNode of the role. If an error occurred while executing the script, this is equivalent to that the script returned 0 items.

Correct script versions (on each line is a new script):





[document.assocs[‘ns:initiator’], document.assocs[‘ns:owner’]]

[document.assocs[‘ns:initiator’], “admin”]

At the moment there is no possibility to create a javascript role in the interface, however, it is  possible to modify type of already created role or in js console (icaseRole:scriptRole is inherited from icaseRole:role) or in the xml case template (roles are located at the template end and their type is specified in one of properties)