Set value in client script not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-28-2016 04:30 AM
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);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-29-2016 02:48 AM
Actually the return value contain more than 200 email ids.Not sure it is happening because of this large data.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-29-2016 03:02 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-29-2016 03:22 AM
I tried with getXMLWait() but it not even calling the script include
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-29-2016 03:53 AM
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 ![]() | ![]() |
Winner of November 2016 Members' Choice Award
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-29-2016 10:23 PM
No still the value is not setting