Automations fail when using a property with JSON containing '
JSON is used to send complex data structures to an automation through a property. A string is constructed using the out-of-the-box JSON data transform.
Error occurs when using a special character ( ' ) in the JSON string when executing the automation from a flow action.
Error in the browser console:
'Uncaught SyntaxError: Unexpected end of JSON input'
Steps to Reproduce
- Create a TestJSON simple flow with a single assignment which calls a TestJSON flow action. Click bullseye to create and open the new flow action.
- In the TestJSON flow action, create TestAutomation (fictious name) for the 'Run robotic automation' field in the pre-processing panel (FYI RAS is not required). Set the SetProperty data transform in the pre-processing panel. Click bullseye to create and open the new data transform.
- In the SetProperty data transform, set TestValiue property to 'Test O'Test. Click bullseye to create TestValiue property as type Text. Save the property and close the property rule.relevant record'.
- In the data transform SetProperty, apply the SerializeJSON data transform. Click bullseye to create the data transform.
- During the creation of the data transform, select JSON data model format and click Create and open.
- In the SerializeJSON data transform, set the Clipboard to .TestValue and the JSON to TestValue. Save and close the data transform rule.
- Set the options of Apply data transform to pass parameters.
- Set TestValueJSON property to param.jsonData. Click bullseye to create Test ValueJSON property as type Text. Save the property and close the property rule.
- In the SetProperty data transform, Save and close the rule form.
- In the TestJSON flow action, Save and close the rule form.
- In the TestJSON flow, save and click the Record Test Case in the Actions menu.
- Open browsers console window and clear all content. Click Done.
The property tested must be added to 'relevant record'
If any relevant record has a single quote ('), the generated Java HTML attempts to break HTML data-automation-propData attribute and causes the exception. Replace the single quote with ASCII HTML entity to make data-automation-propData attribute friendly.
0% found this useful