We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Mark Roethof
Tera Patron

Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

 

Hi there,

 

For many years prefilling variables within a Catalog Item has been a frequently asked question on the ServiceNow Community. Whether you wanted to launch a Catalog Item from a Workspace, Email, Virtual Agent or another application, the goal was often the same: open the Catalog Item with one or more variables already populated.

 

Before the Zurich release, there was no native way to accomplish this. Developers typically relied on custom Catalog Client Scripts that parsed URL parameters and Script Includes to copy values into variables after the form loaded.

 

With the Zurich release, ServiceNow introduced a native solution. Let's have a closer look!


Before Zurich

Prior to Zurich, a common custom implementation accepted a URL parameter such as:

 

&sysparm_variables={"requested_for":"6816f79cc0a8016401c5a33be04be441"}

 

This wasn't an out-of-the-box capability. Instead, a custom Client Script would read the URL, parse the JSON, and populate the variables manually. Brad Tilton wrote an excellent blog covering this subject: 3 Ways to Populate Values in ServiceNow via the URL.


Zurich

Starting with the Zurich release, ServiceNow introduced native support for prefilling Catalog Item variables.

 

Instead of writing custom parsing logic, you can now pass variable values using the new sysparm_variable_values URL parameter:

 

&sysparm_variable_values={
    "requested_for":"6816f79cc0a8016401c5a33be04be441",
    "department":"221db0edc611228401760aec06c9d929"
}

 

The platform automatically populates the matching variables when the Catalog Item opens. Even better, the variables behave exactly as if the user entered the values manually, meaning Catalog Client Scripts and Catalog UI Policies continue to execute as expected.

 

prefill.png

 

It's that simple, I can't share much more, just a small gem you need to know đŸ˜€.


Unsupported variables

It almost sounds too good to be true. Fortunately, the limitations are relatively small. Not every variable type supports prefilling, with Multi-Row Variable Sets (MRVS) probably being the most notable omission.


Variable types that aren't supported for prefill:
- Attachment
- Custom
- Custom with label
- Masked
- UI page
- Multi-row variable set (MRVS)


Enable the Feature

This feature is controlled through system property "glide.sc.enable_url_prefill". This System Property is enabled by default, so in most Zurich instances no additional configuration is required. Once enabled, Catalog Items opened through the Portal or Next Experience can consume values passed through the URL.

 

Although the feature may seem small, it removes the need for a surprising amount of custom code.

Some common use cases include:

- Launching Catalog Items from UI Actions
- Opening Catalog Items from Workspaces
- Deep-linking from emails
- Integrating external applications with ServiceNow
- Passing context from one Catalog Item to another

 

Instead of maintaining custom URL parsing logic, you can now rely on a supported, native platform capability.

---

 

That's it. Finally I finished this article, it was already pending for a while đŸ˜…Hope you like it. If any questions or remarks, let me know!

 

C

If this content helped you, I would appreciate it if you hit bookmark or mark it as helpful.

 

Interested in more Articles, Blogs, Videos, Podcasts, Share projects I shared/participated in?
- Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

 

Kind regards,


Mark Roethof

Independent ServiceNow Consultant
11x ServiceNow MVP

---

LinkedIn

Version history
Last update:
3 weeks ago
Updated by:
Contributors