Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

HOW TO MODITY THE URL LINK IN SERVICEPORTAL ?

KISHORRAJ
Tera Contributor

I have a requirement if I click request in serviceportal then in the request if I select any record in that time the url need change 

Screenshot_20221206_103609.png

 

KISHORRAJ_0-1670303521285.png

If I select any of the incident in the url link https://dev1027.service-now.com/sp?id=ticket&table=incident&sys_id=f12ca18473512300272866     

in this url its default link i need to change the table and sys id is there any way for changing the url for servicenow portal

 

in this url ticket&table =incident need modify or remove the table and also the sys_id=f12ca18473512300272866

 

 can anyone help with this scenario

 

5 REPLIES 5

jaheerhattiwale
Mega Sage

@KISHORRAJ What changes you want to make in that URL?

Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023

Hi @jaheerhattiwale  change the sys_id as instance id and the remove the table option.

https://dev108277.service-now.com/sp?id=ticket&table=incident&sys_id=f12ca18473512300272866.

remove the table and change sys_id as instance id how I can configure this

@KISHORRAJ Please try below code in client script of widget

 

var url = window.location.href;
url = url.split("?");
var newUrl = url[0];

var queryParams = url[1];
queryParams = queryParams.split("&");

for(var i=0; i<queryParams.length; i++){
    if(queryParams[i].startsWith("sys_id")){
       newUrl += "&"+ queryParams[i].replace("sys_id", "instance_id");
    }
}

console.log(newUrl);
 
Please mark as correct answer if this solves your issue.
Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023

hey @jaheerhattiwale is this code need to write in client script servicenow instance or portal widgets