How can I call One UI Page to another UI Page?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2020 05:58 PM
Hello, Newbie here. I'm calling UI_Page_1 from UI action. This UI_page_1 contains a Form. Once users submits this form I'm trying to do validations based on the user inputs through UI_page_1's client script by calling server side script include. If there are some errors, server side script include returns array of errors and I want to throw list of errors in the new UI_Page_2. The issue I'm having is,
1. I can not call the glideajax function from client script. (basically getXML() is erring).
2. Is that possible to call one UI page from another UI page?
Is that something doable or I should look at different approach? Any help would be appreciated.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2020 10:17 PM
Hello Ash,
In first UI Page, write this:
<g:ui_form>
<p>Click OK to run the processing script.</p>
<g:dialog_buttons_ok_cancel ok="return true" />
</g:ui_form>
In Processing Script of first UI Page, write this:
response.sendRedirect("ui_page.do?sys_id=<sys_id_of_second_ui_page>");
Copy sys_id of second UI Page and put it in <sys_id_of_second_ui_page>
Refer below links for more information, it may help you to solve your query.
https://community.servicenow.com/community?id=community_question&sys_id=df9d4f2ddb9cdbc01dcaf3231f9619a8
https://community.servicenow.com/community?id=community_question&sys_id=053364abdbfd4c90d82ffb24399619af
https://community.servicenow.com/community?id=community_question&sys_id=12468fa1db1cdbc01dcaf3231f961944
https://community.servicenow.com/community?id=community_question&sys_id=579b4f61db9cdbc01dcaf3231f961940
https://community.servicenow.com/community?id=community_question&sys_id=22d94329db5cdbc01dcaf3231f961981
https://community.servicenow.com/community?id=community_question&sys_id=532a8f69db5cdbc01dcaf3231f9619fd
https://community.servicenow.com/community?id=community_question&sys_id=3acc4329db9cdbc01dcaf3231f96195c
Kindly mark my answer correct & helpful; if it's useful to you & if it solves your query.
Thanks & Regards,
Pooja Devkar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2020 11:31 PM
Pooja,
Thanks for all the resources. Actually, I'm not looking for just a redirect but I want to use validation on page 1 and get all the errors I find from those validations and show that on Page2. Please let me know if you want me to explain more.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2020 10:29 PM
Hi,
you can call 2nd UI page from 1st via 2 approaches
1) Client Script of 1st UI Page - Using GlideDialogWindow
2) Processing Script of 1st UI Page - using redirect
It would depend on which approach you want
But why to show errors in 2nd UI page? Can't you show them directly via some alert etc or showing html element on 1st UI page itself
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
10-07-2020 11:27 PM
Ankur,
Thanks for the explanation. I separated all the suggestions as follows.
1. I'm trying exactly the same way in the first UI Page but it's breaking. Basically getXML never get executed.
// call from the first UI Page
var ciname = document.getElementById('ciname').value; // Input from first UI page
var gaValidateName = new GlideAjax('script_include');
gaValidateName.addParam('sysparm_name', 'method_name');
gaValidateName.addParam('sysparm_ciname', ciname);
gaValidateName.getXML(function (response) {
var ans = response.responseXML.documentElement.getAttribute('answer');
var ansObj = JSON.parse(ans);
alert(response); //This prints request object not response object
errors = ansObj['errors']; // code is breaking here since we don't have the response
alert(errors);
});
if (errors){
// call second UI page using glidemodal
} else {
// close the First UI Page Form
}
2a. Actually it's a list of errors (sometimes >20 lines) so I want handle pop up in a better way than the alert.
2b. Do you mean cleaning up everything on the form and show error on First UI page itself? Actually, I'm little new with jelly so I didn't think to show them on the same page. Do you have any resource I can refer?