Return to Previous URL from UI Page DialogWindow

Community Alums
Not applicable

Hi All,

We have designed a dialog box which will triggered via UI action present in list context. Once the submit is clicked, we are updating the records and once the processing script is executed i want to page to reloaded to the current URL. 

For this i am using the below code at end of processing script - 

var urlOnStack = GlideSession.get().getStack().bottom();

response.sendRedirect(urlOnStack);

It's working fine but their is one scenario where user is opening the list page and if user open another page in between and then again go to the list page and perform the operation in the dialog box. It's redirecting to the new page which i have opened in between. I think it's due to the session. 

Can you please advise on this.

 

 

 

10 REPLIES 10

Kieran Anson
Kilo Patron

Hi,

Are you not able to use action.setRedirectURL(current)?

Community Alums
Not applicable

Hi Kieran,

Thanks for the response. I tried it but it's not working. 

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

that's because it might be taking the previous url which user has visited; why not form the url itself in the processing script and redirect to that; you already know from where the UI page is called

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Community Alums
Not applicable

Hi Ankur, 

Thanks for the response. 

Actually, user will be using custom filters on the list page and if i hard code the url, it will always redirect to that URL. That's why i am looking for some dynamic solution.