Getting error as "Undefined value has no properties"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2021 11:40 PM
Hello ,
i am trying to pass the JSON to remote change system .
For this we have used flow designer with integration hub .
we are trying to pass the payload with script include ...
when i am testing the action in flow designer i am getting the error as undefine value has no property
Can you please help me where exactly i am going wrong in the script.
var ChangeScriptInclude = Class.create();
ChangeScriptInclude.prototype = {
initialize: function() {},
createChangePayload: function(change_sys_id) {
var changeSysId = change_sys_id;
gs.info('test in prog' + changeSysId);
var changeRec = new GlideRecord('change_request');
var note = changeRec.work_note.getJournalEntry(1);
var v1 = "";
var appr = new GlideRecord('sysapproval_approver');
appr.addQuery('sysapproval', changeSysId);
appr.query();
gs.info(appr.getRowCount());
if (appr.next())
{
v1 = appr.state.toString();
gs.info('into loop' + v1);
}
t1 = "";
t2 = "";
var task = new GlideRecord('change_task');
task.addQuery('number', changeSysId);
if (task.next()) {
t1 = task.state;
}
var changeValues = {};
// changeRec.addQuery('sys_id', changeSysId);
// changeRec.query();
// if (changeRec.next()) {
// var num = changeRec.number;
// gs.addInfoMessage("test" + num);
changeValues.id = changeRec.getDisplayValue('number'), // PMI CHG Number
//"requestType": "changeRec.getValue('type')", // Standard, Normal or Emergency
changeValues.status=changeRec.getValue('state');// 2 for In Progress, -5 for Registred or 3 for Closed
gs.info("into loop1" + v1);
gs.info("comments" + v2);
changeValues.characteristic = [{
"name": "Source System",
"value": "PMI" // Fixed Value
},
{
"name": "Stage",
"value": changeRec.getValue('u_stage') // implement, approve, analyze or verify_and_closevar
},
{
"name": "Customer Confirmation",
"value": v1 //approval result on the change request
},
{
"name": "Customer Confirmation explanation",
"value": note // comments on the approval record
},
{
"name": "Close Code",
"value": t1 // Closed Completed ( if Review Task is completed), Closed Incompleted (if Review Task is Incompleted), Closed Cancelled, Closed Rollback
},
{
"name": "Close Note",
"value": note // The comment that is added on the review task.
}
];
return changeValues;
},
type: 'ChangeScriptInclude'
};
Regards,
Rutuja
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2021 11:52 PM
yepp i am pasing the correct change sys id
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2021 11:57 PM
tried with json.strigify but same issue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2021 12:01 AM
Hi,
did you add logs and check what came in gs.info(JSON.stringify(changeValues));
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2021 12:14 AM
NO ankur i m not getting log for change values
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2021 01:37 AM
it means the script include is not getting called.
Can you share how and from where you are calling the script include
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader