Skip to main content
All CollectionsSystem TasksWorking with Groovy ScriptsGroovy Script Library
Groovy Script - Cancel Workflows of all the Provided Documents

Groovy Script - Cancel Workflows of all the Provided Documents

Updated over 3 weeks ago

Description: Sample Groovy script to cancel workflows of all the provided documents. This script shouldn't be executed with any workflow that is currently running.

Context: Document

Remark: Accessible in 'Post' task mode only.

Script:

def execute(){

String attributeName = "AppStatus";

String attributeValue = "Rejected";

String folderPath = "Asite Project\\Documents";

HashMap optionMap = new HashMap<>();

optionMap.put(RevisionDetailsOption.ALL_REVISION,true);

List<DocumentVO> documents = documentService.getDocsByCustomAttribute(attributeName, attributeValue, folderPath, optionMap);

documentService.cancelWorkflow(documents);

}



Did this answer your question?