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,503 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2016 12:27 AM
Hi Dylan,
This only works when you actually have access to the global scope. Which you won't have if you are developing an application for the store. If you are developing an application 'inhouse' on your own instances than this would work of course, but needs proper documentation in order to revert the customisation when and if a alternative is supplied by ServiceNow.
Kind regards,
Thijs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2016 08:08 AM
Absolutely, there are considerations that must be taken into account.
Are there any other methods that you are aware of?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2016 01:42 PM
You could write a processor instead of a script include, and then in your client script:
jQuery.getJSON(<url_of_your_processor>,function (data) { <your code here> }
The processor should return whatever you want as data in a JSON blob.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2018 11:28 PM
I came across this thread because I was trying to use getXMLWait in a scoped app in an onSubmit client script to perform validation (seems thats what the OP wanted and most others coming here). In my case it was to check if any child tasks were still open before closing a parent task.
For me I returned false by default thus stopping the submission of the form and instead in my AJAX callbacks submit the form again via script.
var gFormAlreadySubmitted = false;
function onSubmit() {
if ( gFormAlreadySubmitted ){
return true;
}
if(g_form.getValue('state') == 3 && g_scratchpad.allowclosewithopenchildren != "true") { //closed
var sysid = g_form.getUniqueValue();
var childtasksajax = new GlideAjax('global.TaskContext');
childtasksajax.addParam('sysparm_name','checkOpenSubTaskCount');
childtasksajax.addParam('sysparm_parentSysid', sysid);
childtasksajax.addParam('sysparm_childTableName', 'sm_event_task');
childtasksajax.addParam('sysparm_parentFieldName', 'sm_event');
childtasksajax.getXMLAnswer(function(answer){
if(answer==0){
save();
} else {
var tablelabel = g_form.getSections()[0].parentElement.getAttribute('tab_caption');
var question = answer + ' tasks attached to this ' + tablelabel + ' are still open. Are you sure you want to close this ' + tablelabel + '?';
var dialog = new GlideDialogWindow('glide_confirm_standard', false);
dialog.setTitle('Are you sure?');
dialog.setPreference('title', question);
dialog.setPreference('warning', true);
dialog.setPreference('onPromptComplete', save);
dialog.setPreference('onPromptCancel', function(){return;});
dialog.render();
}
});
return false;
}
function save(){
gFormAlreadySubmitted = true;
if(g_form.getActionName() == 'sysverb_update_and_stay'){
g_form.save();
}else{
g_form.submit();
}
}
return true;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2018 10:52 AM
I got an error while working on the new catalog items in the Onboarding application.
Access to getXMLWait is not available in scoped applications.
It seems that the script we normally use onSubmit to check if there is an attachment on the catalog item does not work in scoped applications.
onSubmit Client Script:
function onSubmit() {
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);
ga.getXMLWait();
if(ga.getAnswer() == 'true') {
return true;
} else {
g_form.addErrorMessage("Alert! Attach the email generated by your request submitted on the HSG site.");
return false;
}
}
}
Script Include Function Called:
requireAttachment: function() {
var id = this.getParameter("sysparm_cat_id");
var gr = new GlideRecord("sys_attachment");
gr.addQuery("table_name", "sc_cart_item");
gr.addQuery("table_sys_id", id);
gr.query();
if (!gr.next()) {
return false;
}
return true;
},
----------------------------
Does anyone have a good solution for this?
Thanks,
Elliott