How can I link to UI page from another UI page?

jenny32
Tera Guru

Hi All,

        Please help me out !!

                                      In an "UI page",I have a button. Onclick/onsubmit of that ui page I need to map to another "UI page".

                                              I tried using anchor tag but it is not working.

                                                <a href="ui_page.do?name=render_chart"><button>Run</button></a>

                                              Tried client script also but not getting how can I write the functionality to map to another UI page.

Thanks in advance.

Jenny.

1 ACCEPTED SOLUTION

yetesh_ch
ServiceNow Employee
ServiceNow Employee

Hi Jenny,


Do this:



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>


View solution in original post

13 REPLIES 13

yetesh_ch
ServiceNow Employee
ServiceNow Employee

Hi Jenny,


Use <g:dialog_button_ok ok="return true"/> instead of <g:dialog_buttons_ok_cancel ok="return true" />.


Hi yetesh,



                        When I tried   same way before it didn't worked but your code is working fine. Thank you  


What if I want to pass parameters via the URL from page 1 to page 2?



For example:



Processing Script of Page 1



response.sendRedirect('ui_page.do?sys_id=254130cddbd5ba003d81dbd4ce9619a7&myParam=value');



Page 2


var mySysId = RP.getParameterValue('sys_id');


var myParamValue= RP.getParameterValue('myParam');



Result
mySysId = 254130cddbd5ba003d81dbd4ce9619a7
myParamValue is empty



Thanks in advance for any help you can give,
AA


I think I finally answered my own question... well sort of anyway. I updated the redirect to use the page name instead of using the sys_id:



response.sendRedirect('page_name.do?sysparam_param1=value1&sysparam_param2=value2');



As you see I added another test parameter to make sure it could really work with multiple parameters and the values came out correctly using RP.getParameterValue