- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2020 11:51 PM
Hi,
I want to create UI page. In that UI page client script want to display confirm dialog box. When users click on "Ok" trigger
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2020 10:38 PM
Hi,
when you click cancel you are redirecting to new page and form will stay there only
add this
function onCancel() {
var uri = 'home.do';
g_navigation.openPopup(uri);
return false;
}
after processing script is triggered you can redirect to whichever url you want as below
runprocessCode();
function runprocessCode(){
gs.info('Processing script triggered');
// ensure you give valid object for your event queue current won't work here
gs.eventQueue('sendNotification',current, gs.getUserID());
var url = 'your URL here';
response.sendRedirect(url);
}
Let me know if I have answered your question.
If so, please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2020 11:59 PM
Hi,
You can use SP Modal in your UI Page. Refer this page for more details:
https://docs.servicenow.com/bundle/kingston-application-development/page/app-store/dev_portal/API_reference/SPModal/concept/SPModal-API.html#SPM-confirm_S
Thank you,
Palani
Palani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2020 12:34 PM
Is there any way we can achieve Ok and Cancel functionalities?
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">
<g:ui_form>
</g:ui_form>
</j:jelly>
Client script:
var ans = confirm("ATTENTION!! \n\n clicking OK for the to move further.\n\n Click Cancel to move home page.");
if(ans == false){
var uri = 'home.do';
g_navigation.openPopup(uri);
}
else{
runprocessCode();
}
gs.eventQueue('sendNotification',current, gs.getUserID());
}