The CreatorCon Call for Content is officially open! Get started here.

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

Actually the return value contain more than 200 email ids.Not sure it is happening because of this large data.


Yes that might be the reason, I do have a solution for this which might lag the UI for 2-5 seconds. Modify the client script as:



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


var ga = new GlideAjax('Test');


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


  ga.addParam('sysparm_product', product);


  ga.getXMLWait();





var answer = ga.getAnswer();


//alert(answer);


g_form.setValue('contact_email',answer);




Let me know if this helps.


I tried with getXMLWait() but it not even calling the script include


To quickly test if it's the large size, can you try using



g_form.setValue('contact_email',answer.toString().slice(0,99));



Hope this helps.



Please feel free to connect, follow, mark helpful / answer, like, endorse.


John Chun, PhD PMP see John's LinkedIn profile

visit snowaid


ServiceNow Advocate

Winner of November 2016 Members' Choice Award


No still the value is not setting