Client Script: redirect onLoad

tahnalos
Kilo Sage

Hello

We are trying to implement functionality which is supposed to ask for additional information before a Change is worked on.

The intent is that if the assignee is supposed to start work on the change, there may be some additional information that may need to be entered before the change can be worked on.

The idea is to have a redirect from the Change form to this separate form to log details, and once the details are all entered, it is supposed to redirect back to the Change Request form.   This form is supposed to be linked to the Change record as well.

I've seen action.setRedirect being used but that's more on the server side, and wondering if there is a client side redirect I can use?

Thanks.

1 ACCEPTED SOLUTION

Sorry, should be



g_navigation.openPopup( 'change_request.do?sys_id=-1&sysparm_query=parent=' + g_form.getValue('sys_id'), 'New Change');



New Change is the title of the Popup


The sys_id=-1 part opens a new change request


The parent= + g_form.getValue('sys_id') will auto populate the 'parent' field, so you can relate it back to the origin change.



ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

View solution in original post

10 REPLIES 10

You can't hide the back button.



Perhaps the 4th parameter will help?



noStackBooleanTrue to append sysparm_stack=no to the url. This prevents weirdness when using the form back button.


var url = 'change_request.do?sys_id=-1&sysparm_query=parent=' + g_form.getValue('sys_id') + '&sysparm_view=change;


var noStack = true;


g_navigation.openPopup(


      url,


      'New Change',


      'toolbar=no',


        noStack


);



ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022