Using the Json Parser string manipulation method to retrieve information
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:
Element | Description |
---|---|
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: 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:
|
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: where |
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:
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.
Comments
Log in or register to comment.