
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-13-2017 12:38 PM
The API has no examples unfortunately https://developer.servicenow.com/app.do#!/api_doc?v=helsinki&id=c_GlideModalClientSideV3API
https://developer.servicenow.com/app.do#!/api_doc?v=helsinki&id=c_GlideModalClientSideV3API
I know I invoke GlideModal client side on the form but in the UI page, do I just call get(glideModalStringID)
then use getPreference() in a g2 tag?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2017 10:02 AM
Ok since there are zero example of using Glide modal in the API I am posting my code. Hopefully we can get a doc update. https://developer.servicenow.com/app.do#!/api_doc?v=helsinki&id=c_GlideModalClientSideV3API
UI ACTION:
Client Callable: Yes
function confirmAndProcess() {//can call this whatever you want
var message = "TYPE YOUR MESSAGE HERE";
var confirm = new GlideModal('NAME_OF_UI_PAGE',false, 'modal-lg');
confirm.setPreference("sysparm_message", message);confirm.setTitle("Confirm");
confirm.render();
}
//Code that runs without 'onclick' function, this will only run if the client script in the UI page runs that recalls the ui action directly with gsftSubmit(). See UI page code
//Ensure call to server-side function with no browser errors
if (typeof window == 'undefined')
someServerCall();
//Server-side function
function someServerCall(){
current.setValue("state", 15);
current.update();
action.setRedirectURL(current);
}}
UI PAGE HTML:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<j:set var="jvar_pref" value="${sysparm_message}"/>
<div class="modal-body">
<p>
${jvar_pref}
</p>
</div>
<footer class="modal-footer flex">
<g:dialog_buttons_ok_cancel ok="return onOK();" cancel="return onCancel();" ok_type="button" cancel_type="button"/>
</footer>
</j:jelly>
UI PAGE CLIENT SCRIPT:
function onOK() {
gsftSubmit(null, g_form.getFormElement(), 'NAME_OF_UI_ACTION'); //MUST call the
}
function onCancel() {
var o = GlideModal.prototype.get('SCOPE.UI_PAGE_NAME');
o.destroy();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2017 04:50 AM
Hello corbettbrasington,
Great Info thanks.
I tried the same and all is working fine except one, it is not redirecting to me to the same page after updating it.
You have on.setRedirectURL(current) in UI action code, I changed it to action.setRedirectURL(current) and it is working fine also I did not find anything about on.setRedirectURL(current) in servicenow.
Thanks,
Khan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2017 05:10 AM
Thats because......it was a typo!! the editor me must have cut off the "acti" of "action" . Ty for point this out.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2018 10:57 AM
Thank you very much! Your example code saved my day...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2018 12:13 PM
Hello ,
I have created an ui action "Create story" on incident table. I want to invoke the server script in the ui action & its not working. Below is the code :
function openFormDialog(){
var sysId;
if (typeof rowSysId == 'undefined')
sysId = gel('sys_uniqueValue').value;
else
sysId = rowSysId;
var gModalForm = new GlideModalForm('Create Story', 'rm_story');
gModalForm.setPreference('sysparm_view', 'scrum');
gModalForm.addParm('sysparm_query', 'short_description='+
g_form.getValue('short_description') +
'^description='+g_form.getValue('description') +
'^type=Development'+
'^parent='+sysId);
gModalForm.setCompletionCallback(function(action_verb, sys_id, table, displayValue){
if(action_verb == 'sysverb_insert'){
if(typeof GlideList2 !== 'undefined'){
g_navigation.reloadWindow();
if (GlideList2.get("incident.rm_story.parent"))
GlideList2.get("incident.rm_story.parent").refresh();
}
}
});
gModalForm.render();
}
gsftSubmit(null, g_form.getFormElement(), 'create_scrum_story');
}
if (typeof window == 'undefined')
updateINC();
function updateINC(){
gs.log("Testing");
current.work_notes="testing";
current.update();
}
Any leads will be highly appreciated, thank you in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2025 06:13 PM
Thanks for the reference.
Working example like this was very enlightening.