Set value in client script not working

neethu4
Giga Expert

Hi All,

I have written a client script and script include to pull bulk number of email id and setting these email ids in catalog field after submitting the form.

The email ids are coming from the script include but it is not setting into the field.

field type is Multi line Text

Client script

var product= g_form.getValue('product_line');

var ga = new GlideAjax('Test');

  ga.addParam('sysparm_name','getAllContactsofAccount');

  ga.addParam('sysparm_product', product);

  ga.getXML(returnContact);

function returnContact(response) {

var answer = response.responseXML.documentElement.getAttribute("answer");

alert(answer);

g_form.setValue('contact_email',answer);

}

23 REPLIES 23

var Test = Class.create();


Test.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {


  getAllContactsofAccount: function() {


var product = this.getParameter('sysparm_product');


var contact = new GlideRecord('customer_contact');


contact.addQuery('account.u_entitled_products',product);


contact.query();


  var retVal = '';


while(contact.next())


{


retVal +=contact.email;



  if(contact.hasNext())


  {


  retVal += ',';


}


  return retVal;


    },


type: 'Test'


});



It is not setting the value inside the call back function


HI Neethu



Can you please remove global from global.AbstractAjaxProcessor and try


No luck... The script include is in customer service scope.


Is there any restriction for getXMLWait() ?


anurag92
Kilo Sage

I tried the same thing and it worked fine. Did you observe any console/browser-level error after client script is invoked?


No error but some warning is coming but not sure it is related to this


Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.