Hoping somebody can help, because this is a hard dependency for building out our Enterprise Service Desk in JSM.
Background: I'm trying to allow users to 'Clone' a JSM request, but present them with the populated form in a new ticket so they can make whatever changes are needed. I'm attempting to do this in a single automation rule for 120 different forms across 14 different Service Desk projects. So everything is dynamically handled through the API.
As our forms are highly dynamic, making a selection at the very beginning of the form often completely changes the subsequent fields. Actually cloning the ticket works, but then the agent sees answers from the Old form and the New form as changing options doesn't clear out the old fields.
Here's what I've tried that doesn't work:
Clone in the automation rule instead of Create New:
- New Hire A works in an office. New Hire B works remote. Otherwise they need all the same access, tools, etc.
- Manager clones New Hire A's request and changes Work Location to Remote
- Agent receives ticket A with Badge, Cube, Parking Pass
- Agent receives ticket B with Ship equipment to remote, Badge, Cube, Parking Pass even though they SHOULD only see Ship equipment to Remote.
Copying the form from A to B using the Copy Forms endpoint
- Successfully copies the form with all data from ticket A to B
- Does not bring over field data since Create New was used instead of Clone
- Changing the form from Submitted to Open for Edits wipes out all of the answers because it checks against the linked fields which are empty.
Here's what I'm doing now:
- Get Simplified Answers endpoint to successfully pull in the answers from ticket A.
- Save answers as a variable
- Create ticket B
- Attach the same form using Form Template ID
- Set form to customer-facing
- Set form open for edits
- Log action immediately before the PUT web request that shows the valid answers are loaded into the variable and readable.
Here's where I'm stuck
However, when I PUT using the Save Form Answers endpoint with the variable created from the initial GET, I get the following response:
- Unable to publish the web request - received HTTP status response: 400
- Error found in the HTTP body response:
- {"errors":[{"status":400,"code":"BAD_REQUEST","title":"Bad request","detail":"Invalid Json: Unexpected character ('}' (code 125)): expected a value\n at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 3, column: 1]"}]
Can anybody help or offer a better recommendation?