How to push all the sysid's in one array within Glide record.

VIKAS MISHRA
Tera Contributor

Below is my Glide record code, could you please tell me how can i create one array object and add all the sys id's of the records that is coming after adding quesry to that array object.

 

sendSbDataToApttus: function() {
        try {
    var sbRecord = [];
    //var info = {};
   // var response = {};

    var sbReq = new GlideRecord('x_amex_sourcing_request_request');
    sbReq.addEncodedQuery('x_amex_sr_ready_for_conga_push=true');
    sbReq.query();
    var recordCount = sbReq.getRowCount();

    while (sbReq.next()) {
        
        var sbRecJson = {};

        sbRecJson.apttus_contract_id = sbReq.x_amex_sr_contract_id.toString();
        sbRecJson.trm_emailId = sbReq.x_amex_sr_bu_trm_email_address.toString();
        sbRecJson.bu_level1 = sbReq.x_amex_sr_business_unit_level_4.u_level_1.getDisplayValue().toString();
        sbRecJson.bu_level2 = sbReq.x_amex_sr_business_unit_level_4.u_level_2.getDisplayValue().toString();
        sbRecJson.bu_level3 = sbReq.x_amex_sr_business_unit_level_4.u_level_3.getDisplayValue().toString();
        sbRecJson.bu_level4 = sbReq.x_amex_sr_business_unit_level_4.getDisplayValue().toString();
        sbRecJson.countries_to = sbReq.x_amex_sr_location_of_services_to.getDisplayValue().toString();
        sbRecJson.countries_from = sbReq.x_amex_sr_location_of_services_from.getDisplayValue().toString();
        sbRecJson.tlm_Id = sbReq.x_amex_sr_associated_tlm_id.toString();
        if(sbReq.x_amex_sr_pu_bank_impacting.toString().toLowerCase() == 'yes'){
        sbRecJson.isUsBankImpacting = true;
        }
        else{
            sbRecJson.isUsBankImpacting = false;
        }

        sbRecord.push(sbRecJson);
        //To make ready_for_conga_push false after sending to Conga
        sbReq.x_amex_sr_ready_for_conga_push = false;
        sbReq.setWorkflow(false);
        sbReq.autoSysFields(false);
        sbReq.update();

    }

1 ACCEPTED SOLUTION

kunal20
Kilo Guru

Hi Vikas,

To push all sys_ids in one array you need to write this

arr.push(gr.sys_id + "");

use "" to append all sys_ids together.

View solution in original post

2 REPLIES 2

kunal20
Kilo Guru

Hi Vikas,

To push all sys_ids in one array you need to write this

arr.push(gr.sys_id + "");

use "" to append all sys_ids together.

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

what's your business requirement?

Your script looks fine.

Regards
Ankur

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