Create a URL,which is referring to a record

Shraddha Agrawa
Tera Contributor

Hi All,

 

I have a requirement to create a URL which should hit a particular record of the table.

The catch here is that currently we are having the sys_id of the record in the URL, due to which we are unable to hit the record with the URL as the sys_id of the column is not the correct way to hit it.

 

We need to have a mechanism such that we can pass the front end display value of the record along with the created date in URL so that we can hit the record.

 

Any suggestions how to achieve this would be much appreciated.

 

Thanks

 

 

8 REPLIES 8

Anurag Tripathi
Mega Patron
Mega Patron

Hi,

Not sure what the exact use case is and why cant you use a reference field, which would solve all your problems. But to create a url with the sys_id, here it is:

https://<instance Name>.service-now.com/<table name>.do?sys_id=<sys_id of record>

 

You should already have the instance and the table name, you can pass the sys_id dynamically to generate the url.

-Anurag

-Anurag

Hi Anurag,

 

Thanks for the response.

But the sys_ids are hard to remember.

The client has a ask, where can have a sample URL in which he can change the number directly in the URL and get the record open. the field he wants to use in the url is a reference type of field.

Ohh ok now i get it.

Here you go

https://<baseURL>/nav_to.do?uri=<table name>.do?sysparm_query=<field=value>

 

EG

https://<instance name>.service-now.com/incident.do?sysparm_query=number=INC0010001

 

Reference: Examples of navigating by URL | ServiceNow Docs

 

-Anurag

-Anurag

Hi Anurag,

 

I already tried the way you suggested, but the issue i am encountering here is because of the reference field.

 

if i use the above url, it says record not found, because SN gives sys id for every reference field in URL