How to send Multirow variableset data from one instance to another E-boning
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thursday
How to send Multirow variable set variables data from one servicenow instance to another servicenow instacne through E-bonding through flow designer payload in servicwnow.
I am having a form which have multirow varible set , while entering the data on varibale , how to send the data to another servicenow instacne E-bonding I am uing Flow designer and using action and creating payload to send data using script include
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thursday
I shared updated code and commented some code
var Window365SupportRequestGPCPayload = Class.create();
Window365SupportRequestGPCPayload.prototype = {
initialize: function() {},
createRequestPayload: function(request_sysid) {
var requestRec = new GlideRecord('sc_request');
// Check if the request exists
if (!requestRec.get(request_sysid)) {
gs.error('Request not found: ' + request_sysid);
return {};
}
// Fetch associated Requested Item (RITM)
var ritmRec = new GlideRecord('sc_req_item');
ritmRec.addQuery('request', request_sysid);
ritmRec.orderBy('sys_created_on'); // Ensures first RITM is picked if multiple exist
ritmRec.query();
if (!ritmRec.next()) {
gs.error('No Requested Item found for Request: ' + request_sysid);
return {};
}
// Fetch variables from the Requested Item
var variables = {};
// no need of below lines as you can directly grab the MRVS JSON
/*
var mrvsData = [];
var gr = new GlideRecord('sc_multi_row_question_answer');
gr.addQuery('parent_id', ritmRec.sys_id);
gr.query();
while (gr.next()) {
mrvsData.push({
destination_address_aag: gr.value.toString(),
service_port_aag: gr.value.toString(),
purpose_of_this_rule_aag: gr.value.toString(),
});
}
var payload = {
ritm: ritmRec.number.toString(),
mrvs: mrvsData,
};
*/
variables.network_connectivity_aag = JSON.stringify(ritmRec.variables.mrvsVariableSetName); // give mrvs set variable name here
gs.info("test payload " + variables.network_connectivity_aag);
// Single Line Text
//added by me
variables.what_type_of_issue_are_you_having = ritmRec.variables.what_type_of_issue_are_you_having_aag.getValue() || "";
variables.description = ritmRec.variables.description_aag.getDisplayValue() || "";
"";
// Label
variables.bulk_request = ritmRec.variables.bulk_request_aag.getDisplayValue() || "";
variables.windows_365_cloud_pc_guides = ritmRec.variables.windows_365_cloud_pc_guides_aag.getDisplayValue() || "";
//Check box
variables.have_you_read = ritmRec.variables.have_you_read_aag.getDisplayValue() || "";
// Final payload
var requestPayload = {
sysparm_id: '419475871bf7fd100ab097522a4b', // Target Catalog Item sys_id
sysparm_quantity: '1', // Quantity set as a top-level key
variables: {
related_to_new_W365_application: variables.related_to_new_W365_application,
what_type_of_issue_are_you_having: variables.what_type_of_issue_are_you_having,
bulk_request: variables.bulk_request,
windows_365_cloud_pc_guides: variables.windows_365_cloud_pc_guides,
have_you_read: variables.have_you_read,
}
};
return requestPayload;
},
type: 'Window365SupportRequestGPCPayload'
};
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thursday
I commented out that thing and added
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thursday
print what came in log for this
gs.info(JSON.stringify(ritmRec.variables.network_connectivity_aag));
Also print the complete JSON at the end to verify if it looks fine
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Friday
still it is coming as blank but when i uncomment my code it is coming like this
but it should come {"destination_address_aag":"gpc","service_port_aag":"10.3","purpose_of_this_rule_aag":"test"}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Friday
sorry you need to play with the JSON object and then form the JSON string.
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
