execution.getVariable("variableName") - Retrieves a process variable
execution.setVariable("variableName", value) - Sets a process variable
execution.removeVariable("variableName") - Removes a variable from the process
execution.hasVariable("variableName") - Checks whether a variable exists in the process
execution.getProcessInstanceId() || execution.getId() - retrieves the process ID
dashboardsParams = [
"[1]First and last name" : execution.getVariable("clientFullName"),
"[3]General type of disposition" : 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);
var data = execution.getVariable("kgSymulatorData")
//JSON.parse does not work in Camunda
var cif = S(data).prop("cif").value()
var creditAmount = S(data).prop("creditAmount").value()
var phone = S(data).prop("phone").value()
var email = S(data).prop("email").value()
execution.setVariable("cif", cif);
execution.setVariable("creditAmount", creditAmount);
execution.setVariable("phone", phone);
execution.setVariable("email", email);
// The 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)