Description: Sample Groovy Script to cancel workflows for all the provided documents. This script shouldn't be executed with any workflow that is currently running.
Context: Document
Document Type: File
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);
}