Hi everyone,
I'm trying to set up an automation rule that sends a web request when an issue is updated. I’m using the {{changelog}}
smart value to capture what changes occurred. This is the simplified JSON body I’m sending in the web request:
{
"change_summary": "{{changelog}}"
}
When I change the description to a single-line value, the request works fine and the changelog
includes the expected output (see first image).
When I update the description to include multi-line text (another line of text underneath the first line), I receive a 422 error. Nothing in the changelog smart value seems to render, and the request fails due to invalid JSON (second image).
I have tried using .jsonEncode and .urlEncode but that results in an empty string.
If anyone has encountered this or knows a workaround to reliably capture and send multi-line field changes through the web request action, I’d really appreciate the help.
Thanks in advance!
Hi @Kimmee Busby -- Welcome to the Atlassian Community!
I am curious: why send the entire {{changelog}} that way rather than using the {{fromString}} and {{toString}} attributes for {{changelog.description}}?
Regardless of the "why"...
A quick test I did shows the {{toString}} ( and possibly the {{fromString}} ) contain newlines in the changelog for the case you describe. And because you are trying to send the entire {{changelog}} without any parsing, it likely cannot use those encoding functions as you expect because it does not iterate over the attributes to apply the encoding.
Some possible workarounds are:
Kind regards,
Bill
Hi @Bill Sheboy ,
I appreciate you sharing your suggestions!
As for the why not use the {{toString}} for {{changelog.description}}, I had only used the description field as an example of a multi-line field but I have this automation set for any updates to the work items. So ideally, the automation can be used for more use cases than just the description field. Additionally, I created an issue type that has multiple multi-line fields so I was trying to make the automation a little more generalizable. I have no issues trying that if nothing else works, so thanks for bringing that to my attention!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the clarifications.
Please try the workaround with the Create Variable action to see how that helps. That approach will force the conversion to text before the encoding attempt to send to the endpoint.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.