Access to getXMLWait is not available in scoped applications , what is workaround ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2015 01:03 PM
I am trying to query related list on submit and i am getting 'Access to getXMLWait is not available in scoped applications' infomessage on the form.
I am trying to do something similar to Make entry in related list mandatory
any workarounds?
- Labels:
-
User Interface (UI)
- 9,504 Views

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2018 01:43 PM
Hi Elliott, you need to use Asynchronous GlideAJAX and pass in a callback function to get the response (instead of a synchronous call that waits for the response before continuing).
In the response callback you can stop the form submission and show a message or continue the submission based on the result conditions.
Try this code below, note this isn't tested but should help to point you in the right direction. Let me know if you have any questions.
function onSubmit() {
// Check if submission is valid
if (g_scratchpad.isAttachmentValid) {
return true;
}
var q510 = g_form.getValue('service_needed_510');
if (q510 == 'Restore - database') {
var cat_id = gel('sysparm_item_guid').value;
var ga = new GlideAjax('ServiceCatalogAJAX');
ga.addParam('sysparm_name', 'requireAttachment');
ga.addParam('sysparm_cat_id', cat_id);
// Get response from server asynchronously and pass in getAttachmentResponse callback method as a parameter
ga.getXMLAnswer(getAttachmentResponse);
}
// Return false here to stop submission while awaiting the asynchronous response
return false;
}
// Get response callback
function getAttachmentResponse(attachment_response) {
if (attachment_response == 'true') {
// Accept valid submission
g_form.submitted = true;
g_scratchpad.isAttachmentValid = true;
g_form.submit(g_form.getActionName());
return true;
} else {
// Stop submission
g_form.submitted = false;
g_form.addErrorMessage("Alert! Attach the email generated by your request submitted on the HSG site.");
return false;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-03-2018 09:18 AM
THANK YOU!!!
I will try this out soon (when I am back to working on this form) and let you know my results.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-03-2018 02:01 PM
I don't think the scratchpad functionality is supported in a client script in a scoped application so I added a 'hidden' check box field on the catalog item called "submitted" and made some changes to the script. Now, I will run however, it seems to get stuck and does nothing after presenting the alerts (listed below).
=========== start of script ======================
function onSubmit() {
alert('RequireAttachment IS RUNNING');
var submitted = g_form.getValue('submitted');
alert('submitted: ' + submitted);
if (submitted == 'true') {// this prevents recursion
return true;
}
var q53 = g_form.getValue('computer_hardware_requirements_53');
alert('q53: ' + q53);
if(q53 == 'UHG nonstandard developer laptop docking station included lock required' || q53 == 'UHG nonstandard developer desktop monitor keyboard and mouse included') {
alert('Condition met, checking if there is an attachment');
var cat_id = gel('sysparm_item_guid').value;
alert('cat_id: ' + cat_id);
var ga = new GlideAjax('ServiceCatalogAJAX');
ga.addParam('sysparm_name', 'requireAttachment');
ga.addParam('sysparm_cat_id', cat_id);
// Get response from server asynchronously and pass in getAttachmentResponse callback method as a parameter
ga.getXMLAnswer(getAttachmentResponse);
alert('answer returned');
}
// Return false here to stop submission while awaiting the asynchronous response
return false;
}
// Get response callback
function getAttachmentResponse(attachment_response) {
alert('performing callback');
alert('attachment_response: ' + attachment_response);
if (attachment_response == 'true') {
// Accept valid submission
g_form.setValue('submitted', 'true'); // set the hidden value to prevent recursion
g_form.submit(g_form.getActionName());
return true;
} else {
// Stop submission
g_form.addErrorMessage("Alert! The Developer System Questionnaire must be completed and attached to this request.");
return false;
}
}
=========== end of script ======================
BEGIN RESULTS
The result is that it returns the following alerts and then stops and does nothing;
RequireAttachment IS RUNNING
submitted: false
q53: UHG nonstandard developer laptop docking station included lock required
Condition met, checking if there is an attachment
cat_id: 1285b4f3dbb82744967aa895ca961978
answer returned
END RESULTS
I'm not sure where to go at this point. Any thoughts/revisions/suggestions would be greatly appreciated.
Thanks again for your help with this. 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-29-2019 03:36 AM
Thank you

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2018 09:36 PM
I've never had to do this myself (fortunately), but what about using a scripted REST API and calling that from your client script?