Workflow throwing error : Assignment to undefined in strict mode

Pascal P
Kilo Guru

Hello,

 

My workflow action sometime results in "Error", with the mention "Assignment to undefined in strict mode".

But if I run the exact same script in a Background-script, with the same record that threw the error, everything works fine.

Also I was not able to reproduce the error in sub-production environment, but then again, it doesn't fail 100% of the time in Production.

 

Any ideas on why it would fail ?

Thanks 

 

Here is the part of the script that fails: (The undefined variable is said to be optGR)

var variableValue = "";
var varGR = new GlideRecord('sc_item_option_mtom');
varGR.addQuery('request_item',RecordSysId); //p.s. ce code fonctionne pour tout les tables héritée de TASK et non seulement request_item
varGR.query();

while (varGR.next()){

var optGR = new GlideRecord('sc_item_option');
optGR.addQuery('item_option_new.name',VariableName);
optGR.addQuery('sys_id',varGR.sc_item_option);
optGR.query();
while(optGR.next()){
if(!getDisplayValue || optGR.item_option_new.reference.nil())
variableValue = optGR.value;
else{
//Fetch the display value
var dispValGR = new GlideRecord(optGR.item_option_new.reference);
dispValGR.get(optGR.value);
variableValue = dispValGR.getDisplayValue();
}
}
}

 

1 REPLY 1

Omkar Kumbhar
Mega Sage
Mega Sage

Hello @Pascal P ,

Please find the below link 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0787284

 

If I was able to help you with your case, please click the Thumb Icon and mark as Correct.