Is there any way to populate fields using url?

Alon Grod
Tera Expert

Hi,

Is there any way to open a new incident window and populating fields using the url (passing parms and values for parms using the url) and not using client script?

1 ACCEPTED SOLUTION

Robbie
Kilo Patron
Kilo Patron

Hi @Alon Grod,

 

Did you see my earlier response?

It is possible to do this via the workspace as requested. The syntax is very similar. Here's an example using the Service Ops Workspace:

 

https://yourinstance.service-now.com/now/sow/record/interaction/-1_uid_1/params/query/active%3Dtrue%...

 

To add to this, simply add the URL encoding value of '%5E' (which is the ^ symbol also known as &) followed by the field name (eg short_description) followed by the URL encoding value of %3D (which is the = symbol) followed by the value to wish to pass.

 

Eg: e%5Eshort_description%3DTesting

 

As before, if you're trying to populate a field type of reference for example, you'll need to pass the sys_id as shown with the 'assigned_to' field.

 

@Alon Grod To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Helpful.

 

Thanks, Robbie

View solution in original post

9 REPLIES 9

Mark Manders
Mega Patron

You will always need a client script to get the URL and 'translate' it to the fields on your form. Why the requirement to

not use a client script? 


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

piyushsain
Tera Guru
Tera Guru

Hi @Alon Grod 

You can use action.setRedirectURL() in UI Action to redirect to a particular URL , you can pass the prefilled values in the URL . You can also see this article that uses a unique method of redirecting to a page with prefilled values :https://snprotips.com/blog/2021/1/20/processors-srapis-and-how-to-run-a-script-and-redirect-a-user-f...

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,
Piyush Sain

Robbie
Kilo Patron
Kilo Patron

Hi @Alon Grod 

 

Are you attempting to open the new window from ServiceNow itself and populate based on the existing form fields, or If I understand your question correctly, you're attempting 'deep-link' and create an incident from another app or page/form outside of ServiceNow?

 

Essentially, use and adapt the below syntax:

 

(Using Encoded URL)

https://yourinstance.service-now.com/incident.do%3Fsys_id%3D-1%26sysparm_query%3Dshort_description%3...

 

(More user friendly readable format for understanding only. Please use URL encoding as above)

yourinstanceurl/incident.do?sys_id=-1&sysparm_query=short_description=Testing^impact=2^caller_id=5137153cc611227c000bbd1bd8cd2005

 

Please note, if you're trying to prepopulate any fields that are of type Reference for example, you'll need to pass a sys_id as highlighted in the above with the 'caller_id' field.

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Helpful.

 

Thanks, Robbie

@Robbie hi, your answer works for native ui. what if I want to do the same but for the Service Operation workspace. How can I create a new incident with prifilled fields in SOW?