Description: Sample Groovy Script to set the document version to dynamicADecisionVariable, which can be used in the decision gateway condition. This script should only be used along with the workflow.
Note: You can set only a numeric 1 to 99 value to the dynamicADecisionVariable.
Context: Document
Document Type: File
Remark: Accessible in 'Post' task mode only.
Script:
def execute(){
DocumentVO document = documentService.getDocumentDetails();
String documentVersion = document.getVer();
List<ScriptResponseVO> responseActions = new ArrayList<ScriptResponseVO>();
ScriptResponseVO variableParamVo = new ScriptResponseVO();
variableParamVo.setResponseAction(ResponseActionEnum.UPDATE_WORKFLOW_VARIABLE);
Map<String, Object> variableParamMap = new HashMap<>();
variableParamMap.put(IGroovyConstant.DYNAMIC_ADECISION_VARIABLE, documentVersion); // You can set any value between 1 to 99 to this variable
variableParamVo.setResponseObject(variableParamMap);
responseActions.add(variableParamVo);
return responseActions;
}