Skip to main content
Groovy Script - Create Placeholder
Updated this week

Description: Sample groovy script to create placeholder

Context: Document

Remark: Accessible in 'Post' task mode only

Script:

'Create Placeholder' script needs to be used in conjunction with 'Distribute' script to distribute placeholder to users with task.

The following example will create placeholder & assign "For Publishing" task to user1@example.com (with due date after 3 days)
The value ‘---’ in below example can be replaced with suitable value to assign specific POI to placeholder.
To distribute placeholder to distribution group or role, please refer example of relevant distribution given above.

def execute(){

def DocumentVO docVo = documentService.getDocumentDetails();

def revId = createPlaceHolders(docVo,"---");

distributeFile("For Publishing",revId,"user1@example.com", "3","true",true,"1"); // 1. Action to be distributed 2. revisionId of created placeholder 3. user email/role name/group name/Org name 4. Action due days 5. for Place holder true/false 6. send Email Notification true/false 7. type of Distribution 1 – User, 2 – Role, 3 – Org, 4 – Group

}

def createPlaceHolders(def docVo,def poiName){

HashMap<String,String> documentDetails = new HashMap<>();

documentDetails.put("DocRef", docVo.getDocRef());

documentDetails.put("POI", poiName);

documentDetails.put("DocTitle", docVo.getDocTitle());

documentDetails.put("Revision", docVo.getRevision());

documentDetails.put("revisionNotes", docVo.getRevision());

documentDetails.put("publish_as_private","1");

return documentService.createPlaceHolders(documentDetails);

}

def distributeFile(def actionName ,def revisionIds , def distributionList, def actionDueDays, def isForPlaceHolder , def isSendNotification ,def distributionType){

HashMap<Object, Object> distributeFile = new HashMap<Object, Object>();

distributeFile.put("actionName", actionName);

distributeFile.put("revisionIds", revisionIds);

distributeFile.put("distributionList", distributionList);

distributeFile.put("actionDueDays", actionDueDays);

distributeFile.put("isForPlaceHolder", isForPlaceHolder);

distributeFile.put("isSendNotification", isSendNotification);

distributeFile.put("distributionType", distributionType);

return documentService.distributeFile(distributeFile);

}



Did this answer your question?