Hello,
I use an automation to send an outgoing webhook to a 3rd party service with a JSON Payload.
The issue description is included in the payload.
I tried {{issue.description.jsonEncode}} which seemed to be the right way to go. However, when the description contains smart fields like mentions, dates, ..., those are not rendered well.
For exemple a date will be shown as {{2024-07-01}} (with double brackets) and not 2024-07-01. Same for mentions that will be shown by [~accountid:xxxxxxxxx].
A workaround would be to use {{issue.description.text}} which replace those smart fields into something readable in plain text, including account display names, but then I look the markdown formatting including line breaks which is dirty.
Is there a way to have the same kind of smart fields readability (including account display names) while keeping the markdown syntax with JSON encoding?
Short answer: there is no easy way to do this unless you have a very small number of users in your Jira site.
More information...
There is no sequential looping in automation rules, and so it would be challenging to loop through any mentions and find / replace the accountId values with looked-up users. With just a few users, a chain for replaceAll() functions could be used:
{{issue.description.replaceAll("(\[~accountid:1234\])", "Alice").replaceAll("(\[~accountid:5678\])", "Bob")}}
Theoretically, one could use an update of the description field that contains mentions to start a chain to recursively call a webhook triggered rule to find / replace any mentions using the REST API and Send Web Request actions, and store the result in a custom field replicating the description field. One risk with this approach is if there are more than 10 loops the rule will halt due to automation service limits.
Any other formatting may be easier to cleanup, again using the replaceAll() function with a regular expression.
Kind regards,
Bill
Thanks but we have hundreds of users on out Jira instance :(
That doesn't feasible.
Which is sad is that {{htmlEncore(issue.description)}}, {{issue.description.text}} as doing what I want but not in the required format :(
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.