This documentation supports the 22.1 version of BMC Helix Digital Workplace Basic and BMC Helix Digital Workplace Advanced. Icons distinguish capabilities available only for the Advanced and External license levels. For more information, see License types and features.

Using the Json Parser string manipulation method to retrieve information

As a catalog administrator, you can use the Json Parser element to extract a string from the specified JSON in the workflow. The retrieved data can be redirected to the required endpoint, for example, as an in-app notification or an email.

The following workflow uses the Json Parser workflow element to retrieve Work Order Details and Details2, and send them through an email:

Following is a high-level description of each element in this example workflow:

Get Remedy Work Order By ID

Retrieves the work order's request ID, which is needed for the next action (Get Entry). The Get Remedy Work Order By ID element also retrieves other information, but it does not retrieve the Details and Details2 information of the work order. (The next element below helps to resolve this issue.)

Get Entry (Get Work Order Details in the example above)

Retrieves the entry information in the key/value view: " <Field name> " : " <Field value> ". The Get Entry action output has the work order's Details and Details2 information. In this workflow example, we want to find all values with keys that start with WO Type Field.

The Json Parser action (a few elements below) has restrictions that do not allow the action to filter by the partial name of the key, but the action can search by partial value. So, the Get Entry action output is passed to the Build Input Set action.

Build Input Set

Converts the entry information as follows:

   "key": " < Field name > ", 
   "value": " < Field value > " 

Json Parser

With the Build Input Set element's output, finds keys that start with WO Type Field.

The Path For Search parameter in the Json Parser element should look like this:

 "$.inputs[?(@.key =~ /WO Type Field .*/i)]" 

where key should contain the text you want to find, and i means that search will be case insensitive.

Compute Value

Helps to collect the Json Parser output into a nicely formatted string (which includes <br> tags for new lines). You can then use this string as the content for the Send Email action, which uses STRIPHTML to convert the <br> tags into new lines.

In the OUTPUT MAP section for this Compute Value element, the workflow uses the current value of the Content variable (which begins as empty text), and appends the following string to it:

WO detail key : WO detail value ; <new line>

To collect the Content data, the results of the Json Parser element are processed one by one. If the Json Parser element finds five details, this Compute Value element is triggered five times (one for every detail).

A result is assigned to SingleWODetailsObject, and the key and value is retrieved from it, for example:

"${processContext.SingleWoDetailsObject.key} + " : " + ${processContext.SingleWoDetailsObject.value} + ";  <br>"

The MULTI INSTANCE LOOP section uses the Json Parser output:

For information about the output map and multi instance loop, see the following topics:

Send Email

Sends the result, which might look something like this:

For an example of this workflow, see the attached workflow.json file.

Was this page helpful? Yes No Submitting... Thank you