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 01:18 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-29-2016 03:29 AM
HI Neethu
Can you please remove global from global.AbstractAjaxProcessor and try
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-29-2016 03:40 AM
No luck... The script include is in customer service scope.
Is there any restriction for getXMLWait() ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-29-2016 02:14 AM
I tried the same thing and it worked fine. Did you observe any console/browser-level error after client script is invoked?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-29-2016 02:46 AM
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/.