Confirm UI Page when submit/update Incident?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2019 10:53 PM
So here is the scenario:
My customer want us to make an Incident. This is OK. Whenever we submit/update the incident, there will be an UI page show up in the screen. So the point here is it is an UI Page, not a JS, so using confirm('abc') is definitely not a choice.
We are planning to do this like this:
You click the submit button, an Script OnSubmit call the UI Page, which have 2 options : OK / Cancel.
So, how do you do 2 this :
- Call an UI Page from OnSubmit Script.
- Script so if you click Cancel, the UI page disappear, nothing happen. If you click OK, the incident is saved.
Thank you very much, here is my HTML code:
Name: ConfirmUpdate
<?xml version="1.0" encoding="utf-8"?>
<j:jelly trim="true" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<div style="margin-left: 10px; margin-right: 10px; padding-left:10px; padding-right: 10px">
<br/>
<p>${gs.getMessage('Would you like to save all the information as below?')}</p>
<p>${gs.getMessage('Incident Number : ') + gs.getValue('category')}</p>
<br/>
<table border="0" width="200" height="100">
<tr>
<td align="right">
<g:dialog_buttons_ok_cancel ok="return onOK();" cancel="return onCancel();" ok_type="button" cancel_type="button" ok_text="${gs.getMessage('Save')}" cancel_text="${gs.getMessage('Cancel')}"/>
</td>
</tr>
</table>
</div>
</j:jelly>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2019 11:25 PM
Hello,
What you want to look at is GlideModal on the developer page.
https://developer.servicenow.com/app.do#!/api_doc?v=london&id=r_GMODV3-GlideModal_S_B_N_N
This is a simple version I made for a record producer.
In order to open the UI Page, add this in the Client Script:
var modal = new GlideModal('UI PAGE NAME', true, 800);
modal.setPreference('sysparm_somevariable', 'datatosend');
modal.setTitle('TITLE OF POPUP');
modal.render();
In the Client Script part of the UI Page I added this to close the modal:
function cancelWindow(){
var closePop = GlideModal.prototype.get('UI PAGE NAME');
closePop.destroy();
}
But, as this is a GlideModal and not GlideModalForm you can trigger variables in your script from your modal. So say you want to submit the ticket if OK is clicked, have the function for ok make the client script "return true" (any onSubmit that results in return true will submit as normal).
The Cancel should return false for the Client Script.
I hope this helps a little.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2019 11:48 PM
Thank you very much, the UI Pagge show up.
The only problem is I don;t know the script work or not, the Incident page being update immediately so I don't even have a chance to click the OK/Cancel button.
Are there any way so the UI Page will be show up for me to click the button, I think this is the Script problem.
Here is the code:
function onSubmit() {
//Type appropriate comment here, and begin script below
if(g_form.modified){
var modal = new GlideModal('ConfirmUpdate', true, 800);
modal.setPreference('sysparm_category', 'category');
modal.setTitle('Aloha babe');
modal.render();
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2019 01:12 AM
https://www.servicenowguru.com/system-ui/glidedialogwindow-advanced-popups-ui-pages/ use this thread amd mark helpful if it resolves your issue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2019 05:19 AM
I just want to add that, although it is a good guide, it is also 9 years old and there are a lot of new systems in ServiceNow that does that quicker and cleaner; such as GlideModal v3.