Issue with pushing values to array

vidhya_mouli
Giga Sage

This line of code works in Background Script but fails in Script Include:

phonelist.push('+47' + employeeLookUp.mobile_phone.toString());


Any knows why and what is the alternative?
Script include is client callable.

3 REPLIES 3

dgarad
Giga Sage

Hi @vidhya_mouli 

what is exact error.

If my answer finds you well, helpful, and related to the question asked. Please mark it as correct and helpful.

Thanks
dgarad

Jitendra Diwak1
Kilo Sage

Hi @vidhya_mouli,

 

If possible, could you please share the error or screenshot for the reference.

 

Thanks

Jitendra

Please accept my solution if it works for and thumps up.

Maddysunil
Kilo Sage

@vidhya_mouli 

if you're calling the Script Include from the client-side and need to manipulate data from a GlideRecord, you could consider passing the required data to the Script Include as parameters, performing the necessary operations within the Script Include, and then returning the result back to the client-side code.

For example, you could have the client-side code pass the employeeLookUp object or just the mobile_phone value as a parameter to the Script Include. Then, within the Script Include, you can manipulate the data and return the desired result. Something like below

 

var MyScriptInclude = Class.create();
MyScriptInclude.prototype = {
    initialize: function() {},

    // Method to process mobile phone number
    processMobilePhone: function() {
      var mobilePhone=this,getParameter('sysparm_mobile')//sysparm_mobile from client side
        var phoneNumber = '+47' + mobilePhone;
        return phoneNumber;
    },

    type: 'MyScriptInclude'
};

 

Please Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Thanks