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  

Populate reference field on record producer URL

mdandrade
Kilo Contributor

I would like to use a URL to create and populate a record with predefined values. I am able to populate all fields on the new form with the exception of a reference field. I will be able to provide the number of the record associated with the reference field (i.e. INCxxxxxxx), but the field will only be populated when I supply the sys_id. Is there a way to convert the record number into the associated sys_id within the record producer URL?

 

Example

Works:

https://service-now.com/nav_to.do?uri=task_time_worked.do?sys_id=-1%26sysparm_query%3Dtask%3Dd25e4d22db725b048d067fda8c96191e

Does not work:

https://service-now.com/nav_to.do?uri=task_time_worked.do?sys_id=-1%26sysparm_query%3Dtask%3DTASK0191936

 

8 REPLIES 8

Allen Andreas
Tera Patron

How are you generating this link?

Not sure how this is all starting...like is this coming from a notification? Is a script generating this URL?etc?

 

If so, you can glide to the table, get the sys_id, then create and show the URL...

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hi Allen, This is a user generated URL. I am just looking for a quick and fast way to generate a record from outside the system with certain values filled in on creation, and thought a URL would be the easiest method. So basically I’m just looking for a way to populate the reference field, using the URL method, by only feeding in the record number instead of the sys_id.

This would be what you'd use for Incident...so convert this to work for Task:

sysparm_query=number=INC00040

Please mark reply as Helpful/Correct. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Maybe I'm not understanding correctly, but I am currently using a similar URL as to the one below to insert a new record in the time worked table. One of the fields that I'm populating via the url is a reference field to the task table. When I use the "sysparm_query=number" option, the reference field will remain blank, but when I use the sys_id, it populates. I would like a way to provide the task number to fill in the task reference field on the newly inserted form, instead of having to use the sys_id.

 

Works:

https://service-now.com/nav_to.do?uri=task_time_worked.do?sys_id=-1%26sysparm_query%3Dtask%3D18d068540f29a6000def563be1050eab

find_real_file.png

Does Not Work:

https://service-now.com/nav_to.do?uri=task_time_worked.do?sys_id=-1%26sysparm_query%3Dtask%3DINC0412228

find_real_file.png