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?
Am I correct here by stating, you want to clone an issue and it's form, the original submitted form on the to be cloned issue?
But you want to change the form answers changed in the from on the cloned issue?
@Marc -Devoteam- You're correct. If a manager answers 40 questions to onboard user A, it would be really nice if they could simply clone that onboarding ticket and simply change the user's name and a few other details like location to onboard user B.
Multiply this across 120 different request types and you have a pretty significant time savings.
I'm running into an issue because Cloning the original keeps all of the fields. When you change an option on a JSM dynamic form like Location from In Office to Remote, the In Office questions don't get cleared, they simply don't show up for the end-user. In the agent view, the Location would be set to Remote, but questions like Parking Pass and Desk would also be answered.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Mathew Lederman and @Marc -Devoteam- , would the automation action Attach Form with Values be helpful in this case?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Susan Waldrip it does, as the form is attached with the form fields populated exactly as desired. However, when you open the form for edits the system checks the linked Jira fields to populate the form. If you create a new ticket there are no linked fields, so the form is empty on state change. If you clone, you run into the issues I shared above.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ah, okay. Sounds like a great JSDCLOUD request, but I hope you find an answer before that's implemented. 😊
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It's unfortunate that so much standard functionality for enterprise-tier service desk tools is simply absent from JSM.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I guess the issue is only with form field that are linked to a Jira field right.
If you have form fields not linked to a Jira field, are they cleared?
If this is the case, this is an option, but I do think you make use of fields, maybe based on assets or else, that you do require for KPI's or reporting?
The API endpoint "external data" gives you all the options for the fields used on the for, it provides the configuration and options for each field on the form.
I don't think it provides the content of a submitted form.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Mathew Lederman
Get form simplified answers returns a flattened list meant for scripting convenience, and Atlassian documents it as an array<FormSimplifiedAnswer>, with multivalue answers flattened into a comma-separated string. But Save form answers expects a request body with an answers object. Those 2 formats are not interchangeable.
The current 400 is likely because the API body is built from the wrong response format, and even after that is fixed, you may still need extra logic for conditional fields that should be cleared.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Arkadiusz Wroblewski I had this realization late last night after I posted this. Do you know if there is a way to get the answers from a form in the format needed for the Save Form endpoint? The externaldata endpoint seems more similar, but not identical.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.