Scripts

42 Ways to Access Workflow Variables

It's not always easy to discover when and how to access orchestration and workflow input and activity output values when designing a workflow in ServiceNow. 

Ok, forty-two ways might be a slight exaggeration. We'll take a look at a couple shortcuts, some frustrating limitations, and an easy consistent solution to speed up your workflow development.

FujiForty - Form Charts (advanced conditions)

There was a recent question on my first Form Charts post regarding advanced conditions. Since it's not really documented I did some experimenting.

In the last example I used a simple report filter. Show the "All Incidents by Category" report where the incident location is equal to the current form's incident location. Using this form chart interface limits you to a direct field mapping (location = current.location). 

If you require a more advanced condition such as an OR condition you'll have to jump over to the "Advanced condition extension".

FujiForty - JSON Processor API Shortcut

After the initial frustration with a locked down and undocumented Fuji scripted processor API I avoided them as much as possible. But sometime you just can't avoid them. I recently had a need to build a REST-like integration because the client app couldn't use SOAP, so scripted web services weren't an option. Since scripted REST services don't exist...yet, I needed to use a scripted processor to capture a POST request with JSON and return a JSON payload. 

FujiForty - Table Hierarchy API

One of the powerful and efficient concepts found in the ServiceNow platform is the ability to extend existing table schemas. This not only makes table creation faster and easier, it also allows you to inherit business processing logic and report on an aggregate of data across hierarchical tables. For example, a worker can display all of there work in a single queue even though the data appears to be in different tables.

FujiForty - There's no "u" in fieldname

If you haven’t heard yet, Fuji introduces a new concept of application fencing. This allows for tighter control of what each application and it’s process can do. In the past, any process on the platform could access any data on the platform as long as it passed user security checks. This can present stability concerns when building custom applications and especially when installing 3rd party applications from the upcoming marketplace.

Multiple AJAX Values

GlideAJAX comes up in most client side use cases. Many times all you need is a simple value, but in more advanced cases you’ll need a collection of data return for client processing, especially if it helps you reduce the number of round trips to the server.

In this example I’ll show you two different ways (multiple nodes of name value pairs, and a node with multiple attributes) of returning data from a client-callable AJAX script include. Stay tuned for a followup post on how to understand the data being passed and troubleshoot the process.GlideAJAX comes up in most client side use cases. Many times all you need is a simple value, but in more advanced cases you’ll need a collection of data return for client processing, especially if it helps you reduce the number of round trips to the server.

In this example I’ll show you two different ways (multiple nodes of name value pairs, and a node with multiple attributes) of returning data from a client-callable AJAX script include. Stay tuned for a followup post on how to understand the data being passed and troubleshoot the process.