How to create a json payload in script include ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2022 01:13 AM
Hello experts,
My requirement is to transfer the worknotes and additional comments to target instance whenever worknotes changes or additional comments changes in source instance.
I have used Ebonding.
But while creating payload i am not able to get the correct data in my payload:
Below is the script I am using:
var PayloadBuilderUpdate = Class.create();
PayloadBuilderUpdate.prototype = {
initialize: function() {
},
createIncidentPayloadUpdate:function(incident_sys_id){
var incidentSysId = incident_sys_id;
var incidentRec = new GlideRecord('incident');
//incidentRec.get(incidentSysId);
incidentRec.addQuery('sys_id',incidentSysId);
incidentRec.query();
while(incidentRec.next())
{
if(incidentRec.work_notes.changes())
{
var incidentValues = {};
incidentValues.work_notes =incidentRec.work_notes.getJournalEntry(1);
//comments: incidentRec.comments.getJournalEntry(1)
}
}
return incidentValues;
},
type: 'PayloadBuilderUpdate'
};
Can you please help here.
Thanks in advance!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2022 05:38 AM
Hi Mahak
I think its better if you provide most of the information at one go , its confusing 🙂
Based on what you have shared at the moment - here is my suggestion - This link shows how to use flow api - which means you can pass input parameters dynamically - so hypothetically you can pass field name and values to the flow and make flow such that it takes action based on inputs
See if this works out or too much ATM