Error during JavaScript evaluation com.snc.pa.dc.ScriptException: JavaScript evaluation returned
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2022 01:46 PM
Hello All,
Trying to create breakdown mapping on HR case - Metric Instance database view to get breakdown on task type
Below is the snapshot of script
but on running the data collector job i am getting error stating - " Error during JavaScript evaluation com.snc.pa.dc.ScriptException: JavaScript evaluation returned: Undefined in script:"
Please suggest
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2022 06:58 PM
HI @shawshipra
I'm not sure of this, but in the pic there is a note above the script field " script need to be referenced by column name(not column lable.)",
and your scripts returns sys_id not column name...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2022 07:36 PM
Paste that script here
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2022 07:58 PM
Hello shyamsundar,
PFB script:
function getTaskType() {
// gs.log("HR Task Type Log Checkkkk 000");
// gs.log("HR Task Type Log Check 0077" + current.mi_table);
var grTable = new GlideRecord('sys_db_object');
grTable.addQuery('name', current.mi_table);
grTable.query();
if (grTable.next()) {
return grTable.sys_id;
}
}
getTaskType();
Regards,
Shipra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2022 07:58 PM
Hi @shawshipra,
Try this updated scripts -
function getTaskType(){
var table_name = "incident"; // add tbale name here
var tableObj = new GlideRecord("sys_db_object");
tableObj.addQuery("name", table_name);
tableObj.query();
if(tableObj.next()){
return tableObj.getUniqueValue();
}
}
getTaskType();
Thanks,
Sagar Pagar