Help in Scripting if(gr.next()) is not working

priya149
Mega Contributor

After madrid upgrade this script is not working in prod, the same is working in kingston.

Below code is displaying description of incident on approval request in portal but description is not getting visible after madrid upgrade only for incident.

kindly guide if anything wrong in it.

if (record.source_table == 'incident') {
gs.log("Madrid Changes hello");
var inc = new GlideRecord('incident');
inc.addQuery('sys_id', record.sysapproval.sys_id.toString());
gs.log("Madrid Changes variable" + record.sysapproval.sys_id.toString());
inc.query();

if (inc.next())

{

gs.log("Madrid changes dsc" + inc.description.toString());
ticket.description = inc.description.toString();
ticket.comment_approval = 'true';

}

}

Logs are not coming inside if (inc.next()) and if I remove the IF condition value is not coming in  inc.description.toString();

In sort inc.description.toString(); is not working as well.

25 REPLIES 25

Result -

Madrid Changes variable5f1f9d2fdb217b40c4759ef7db96196f

Row Count is0 

 

Hi 

What are you getting in the record.sysapproval?

 

Instead i think you should try with,

inc.addQuery('caller_id', record.sysapproval);

 

OR

 

inc.addQuery('assigned_to', record.sysapproval);

Which sys_id is record.sysapproval holding? User or incident sys_id?

Its matching the sys id of incident and approval's approval for field sysid i.e incident number