Skip to main content
Groovy Script - Assign Role to Users by Email
Updated over a month ago

Description: Sample groovy script to assign role to users by email

Context: Document

Remark: Accessible in 'Post' task mode only

Script:

def execute(){

List<String> recipientList = new ArrayList<>();

List<String> docControllarRecipientList = new ArrayList<>();

Map<String, Object> params = new HashMap<>();

Map<String, List<String>> roleAndUsersEmailMap = new HashMap<>();

recipientList.add("user1@example.com");

docControllarRecipientList.add("user2@example.com")

roleAndUsersEmailMap.put("TestRole", recipientList);

roleAndUsersEmailMap.put("DocController", docControllarRecipientList);

params.put(IGroovyConstant.ROLES_AND_USERS_EMAIL_MAP, roleAndUsersEmailMap);

formService.assignRolesByUserEmail(params);

}



Did this answer your question?