Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

How to send Multirow variableset data from one instance to another E-boning

shashanksha
Tera Contributor

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

 

shashanksha_1-1760629414286.png

 

 

shashanksha_0-1760629335941.png

 

9 REPLIES 9

Ankur Bawiskar
Tera Patron

@shashanksha 

you can send the data for MRVS which is a JSON string and include in your payload

Did you try that?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

can u give me the example, i am using

 

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({
                field1.: gr.field1.toString(),
                field2: gr.field2.toString()
            });
        }
        var payload = {
            ritm: current.number,
            mrvs: mrvsData
        };

 

@shashanksha 

share complete script.

you can directly grab the MRVS without querying sc_multi_row_question_answer table

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

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 = {};
 
        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(mrvsData);
        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'
};

Through this i need to send Multi row variable set payload to another servicenow instacne E-bonding purpose so that another insntacne user can fetch it