How to implement a back button in the Service Portal

Yokota Misaki
Tera Expert

After submitting a record in the service portal, what script should I write in the UI action to return to the previous screen?
Please let us know.

 

In the URL of the screen where you press the [New] button to create a record
SySID of the record associated with the new record is embedded in the URL of the screen where the [New] button is pressed to create a record.

It looks like this

ex)  https://[ inctance name ].service-now.com/sp?id=lf&table=[ table name ] &filter=[ table name 2 ]%3D{ Sysid }&view=[ View name ]


We apologize for our poor English.

Best regards.

2 ACCEPTED SOLUTIONS

After researching, we learned that UI actions are not supported in the Service Portal.
Therefore, we will give up on this implementation.
Thank you very much.

View solution in original post

Community Alums
Not applicable

Hi @Yokota Misaki ,

You have marked your own answer as Correct mistakenly !! As that's not correct answer.

you can only show UI actions on the form in portal which are Server Side.

 

View solution in original post

6 REPLIES 6

Community Alums
Not applicable

Thank you Sandeep Dutta.
I did look over that too, but HTML should not be available in the UI action that creates the button.
What code should I write to adapt it in the UI action?

 

I currently have the code written as follows
window and location are not defined and I get an error.

 

 

action.setRedirectURL(current);
current.update();
action.setRedirectURL(window.location=history.back);

YokotaMisaki_1-1666923685835.png

 

Yokota Misaki
Tera Expert

For your information, the URL of the transition source is as follows.
[ inctance name ].service-now.com/sp?id=form&table=[ table name ]&view=[ View name ]sys_id=-1&query=[ table name 2 ]%3D{ Sysid }

The URL you want to set as the transition destination is as follows.
[ inctance name ].service-now.com/sp?id=lf&table=[ table name ] &filter=[ table name 2 ]%3D{ Sysid }&view=[ View name]

Sys id is the same for both source and destination of transition.
Thanks in advance.

Community Alums
Not applicable

Yes!! SysID is same.