BPMS script task (scriptTask)
Documentation
Attaching a ScriptTask to the process

Popular methods
Last updated
Was this helpful?

Last updated
Was this helpful?
Was this helpful?
execution.getVariable("variableName") - Gets a process variable
execution.setVariable("variableName", value) - Sets a process variable
execution.removeVariable("variableName") - Removes a variable from the process
execution.hasVariable("variableName") - Checks if a variable exists in the process
execution.getProcessInstanceId() || execution.getId() - retrieves the process ID dashboardsParams = [
"[1]Full name" : execution.getVariable("clientFullName"),
"[3]General disposition type" : execution.getVariable("globalCaseTypeName"),
"[4]Product group" : execution.getVariable("caseGroupName"),
"[5]Disposition" : execution.getVariable("caseTypeName"),
"[13]Last person processing:" : execution.getVariable('executorFirstName') +
" " +
execution.getVariable('executorLastName') +
" (" +
execution.getVariable('executorId') +
")"
];
if (execution.getVariable("corpFullName") != null) {
dashboardsParams["[2]Company"] = execution.getVariable("corpFullName");
}
dateFormat = "dd.MM.yyyy h:mm"
if (execution.getVariable("startBusinessStatusDate") != null) {
dashboardsParams["[8]Process start date:"] = execution.getVariable("startBusinessStatusDate").format(dateFormat)
}
if (execution.getVariable("tour1BusinessStatusDate") != null) {
dashboardsParams["[9]Start date of round I:"] = execution.getVariable("tour1BusinessStatusDate").format(dateFormat)
}
if (execution.getVariable("tour2BusinessStatusDate") != null) {
dashboardsParams["[10]Start date of round II:"] = execution.getVariable("tour2BusinessStatusDate").format(dateFormat)
}
if (execution.getVariable("tour3BusinessStatusDate") != null) {
dashboardsParams["[11]Start date of round III:"] = execution.getVariable("tour3BusinessStatusDate").format(dateFormat)
}
if (execution.getVariable("endBusinessStatusDate") != null) {
dashboardsParams["[12]Process end date:"] = execution.getVariable("endBusinessStatusDate").format(dateFormat)
}
if (execution.getVariable("sposobWysylki") == "false"){
dashboardsParams["[14]Shipping method:"] = "e-mail"
}
execution.setVariable("TASK_DASHBOARD", dashboardsParams);
execution.setVariable("PROCESS_DASHBOARD", dashboardsParams);const data = execution.getVariable("kgSymulatorData")
const cif = S(data).prop("cif").value()
const creditAmount = S(data).prop("creditAmount").value()
const phone = S(data).prop("phone").value()
const email = S(data).prop("email").value()
execution.setVariable("cif", cif);
execution.setVariable("creditAmount", creditAmount);
execution.setVariable("phone", phone);
execution.setVariable("email", email);// Value skpToControl -> [{"skp":"198500"},{"skp":"198700"}]
def raw = execution.getVariable("skpToControl")
def parsed = new groovy.json.JsonSlurper().parseText(raw)
def list = parsed.collect { item ->
def m = [:]
item.each { k, v -> m[k] = v }
return m
}
execution.setVariable("skpObj", list)