"Error occured while parsing Json string to map" on Powershell Steps as JSON Val Encoding is not applied - Serialization of Array.String data type in payload builder generates invalid JSON failing user import in Lightstep Incident Response


Description

JSON Val Encoder was previously applied to all Name/Value pairs. Since Rome Patch 3, it is not applied on REST, SOAP, Powershell, and Payload Builder action steps, as those are missing JSON escaping.

For versions prior to Rome Patch 5, an error can occur where the serialization of the Array.String data type in the Payload Builder step generates an invalid JSON. Importing enterprise user fails in Lightstep Incident Response. Instances on Quebec do not experience this issue.

Steps to Reproduce

This defect affects REST, SOAP, Powershell, and Payload Builder action steps, but the below steps are for REST:

0. Login a Rome Patch 2-3 instance

1. Import and commit the attached Update Set

2. Create a sys_trigger with the following:
Name: Create Incident
Trigger Type: Repeat
Repeat: 0 days 0 hours 1 minute 0 seconds
State: Ready
Script: 
var gr = new GlideRecord("incident");
gr.short_description = "Trigger Flow";
gr.insert();

3. Check the sys_flow_context table and verify the flow with name=payload is running successfully once every minute (state=Complete)

4. Upgrade the instance to Rome Patch 3-4

5. Check the sys_flow_context table and verify the flow with name=payload is running every minute showing state=Error

Workaround

This problem has been fixed. If you are able to upgrade, review the Fixed In section to determine the latest version with a permanent fix your instance can be upgraded to.

There are two possible workarounds if an upgrade is not possible:

  1. Re-publish the impacted actions by making a benign change to the action and then activating it again. Use this relative link to find impacted actions: /sys_hub_step_instance_list.do?sysparm_query=step_type%3D07a762fb47222200b4fad7527c9a7129%5EORstep_type%3D6e61d40e73031300e6561afe2ff6a704%5EORstep_type%3D486f577a3721030003a08fb77e41f1d6%5EORstep_type%3D2429af02b3331300176b051a16a8dcab&sysparm_view=

  2. Create the new system property com.glide.hub.flow_engine.json_val_encoding_with_attribute with a value of false. After the property is changed, flows using the action need to be re-compiled for it to take effect. See KB0963031 for information on how to do this.

Related Problem: PRB1546744