Creating incidents based on the selected template in interaction

Hello professionals!

Please help to find a solution for my problem

Guidelines tasked to develop the following functions :

1) Users registering an interaction on the self-service portal selects a previously created template for interaction

2) After saving interaction, the system automatically creates an incident using a previously created template for incidents

I tried to do the following :

 - I created a trigger for the table incidents with the trigger type "After add" and with the following JS code:

var isESS = system.functions.nullsub(vars.$G_ess, false);
var isBG = system.functions.nullsub(vars.$G_bg, false);
var actionName = "HPC.SD.Escalate";
if (record.category == "incident" && record.hpc_escalate_by_template != null && (isESS || isBG)){
var resik = lib.interoperabilityHelpers.scheduleAction(record, actionName);
}

- then I created a ioactions record with the following JS code:

var actionName = "HPC.SD.Escalate";
if (system.functions.filename(vars.$L_file) == "incidents"){
print("ioaction: " actionName " for " vars.$L_file.incident_id);
var result = vars.$L_file.doAction("escalate");
if ( result == RC_CANT_HAVE || result == 51 ){
lib.interoperabilityHelpers.rescheduleAction(actionName, vars.$L_file);
}
}

Action "escalate" run the process sd.escalate

This process has the following parameters:

"Initial Expressions" tab:

$isSDEscalatedIncident=true
$L.old.open=open in $L.file
$L.comment="$escalation.wizard.call to let following processing works in background mode"
if $G.bg then ($escalation.wizard.call=true)

"RAD" tab:

Expressions evaluated befor RAD call:

$L.continue=true
if null(category in $L.file) then ($L.continue=false)
if (rtecall("recordexists", $L.rc, "incidents", "incident.id=\"" incident.id in $L.file "\"")=true) then ($L.exists=true) else ($L.exists=false)
$L.es.action=NULL
if ($L.exists=false) then ($L.es.action="add") else ($L.es.action="save")
if ($L.continue and $L.exists=false) then ($L.value=true) else ($L.value=false)

RAD application: se.veiw.engine           Condition: $L.continue and not (null($L.es.action))
Parameter names:                                  Parameter value:
file                                                           $L.file
description                                             $L.es.action

Post RAD expressions:

 

 

if ($L.es.action={"added", "normal", "resetrec"}) then ($L.continue=true) else ($L.continue=false)
$L.exit=$L.es.action

Expressions evaluated befor RAD call:

$L.escalateRelation=""
if (rtecall("recordexists", $L.rc, "incidents", "incident.id=\"" incident.id in $L.file "\"")=true) then ($L.exists=true) else ($L.exists=false)
if (category in $L.file="request for change") then ($L.escalateRelation="isLinkedTo.Change") else ($L.escalateRelation="isLinkedTo.Incident")
$cust.visible=false
$activity.type=""
$L.exit.match="null"

RAD application: incident.matching          Condition: nullsub($G.bg, false)=false and $L.continue and $L.exists=true                                                                                          and $L.escalateRelation="isLinkedTo.Incident"
Parameter names:                                       Parameter value:
file                                                                $L.file
name                                                           $L.escalateRelation
types                                                           $L.exit.match

Expressions evaluated befor RAD call:

$L.void=jscall("RelationUtil.populateAction", $L.escalateRelation, "open")
$relationType="Escalation"
$L.doEscalate=$L.continue and $L.exists=true and not (null($relateAction)) and ($L.exit.match="null" or $L.exit.match="new")

RAD application: us.screlate.options         Condition: $L.doEscalate
Parameter names:                                       Parameter value:
file                                                                $L.file
second.file                                                   $L.object
name                                                           $relateAction

Expressions evaluated befor RAD call:

if $L.doEscalate then ($escalated.done=jscall("sdUtil.isEscalated", $L.file);$escalated=$escalated.done)
$bypass.failed.validation=true

RAD application: se.veiw.engine           Condition: $L.doEscalate=true and $escalated.done=true
Parameter names:                                  Parameter value:
file                                                           $L.file
description                                             "_wfE:event.linked:escalation"

Post RAD expressions:

$bypass.failed.validation=false

When I register an interaction with the desired me template, HP SM сorrectly saves interaction и schedul the ioaction, but then in message log i see  error message like "Unrecoverable error in application: %S on panel %S" or or nothing happens and the incident is not created

 

Please select the error in that decision or offer other options.

HP SM version 9.32