Skip to main content
All CollectionsSystem TasksWorking with Groovy ScriptsGroovy Script Library
Groovy Script - Cancel Running Workflows on Current, Previous or Superseded Revisions
Groovy Script - Cancel Running Workflows on Current, Previous or Superseded Revisions
Updated yesterday

Description: Sample groovy script to cancel running workflows on current, previous or superseded revisions

Context: Document

Remark: Accessible in 'Post' task mode only

Script:

def execute(){

// fetch current revision detail

DocumentVO document = documentService.getDocumentDetails();

//Define condition to cancel workflow on current revision based on document’s status

//IGroovyConstant.CURRENT_REVISION should be used with direct system action only not via workflow

if(document.getStatus().equals("Internal Approved")) {

documentService.cancelWorkflow(IGroovyConstant.CURRENT_REVISION);

} else if(document.getStatus().equals("Approved")) {

documentService.cancelWorkflow(IGroovyConstant.SUPERSEDED_REVISION);

} else if(document.getStatus().equals("Finance Approved")) {

documentService.cancelWorkflow(IGroovyConstant.PREVIOUS_REVISION);

}

}



Did this answer your question?