I have an automation that sends the comments made to an issue to a Slack channel, replacing the user tag in Jira side with the appropriate user tag on Slack side (so people get notified).
What works so far:
On Jira, the mention appears as `[~accountid:7120...ff4600c98]`. I implemented a replace action (actually many of them in one rule) to change each account to Slack's corresponding string `<@U5D3UAZHC0J>`. To perform replace after replace, I save the comments filed to a variable {{message}}, and using "Create Variable" multiple times, I replace each entry and update {{message}} (as in the screenshot). The field "Smart Value" of these replacement is hard-coded for all.
Short answer: there is no synchronous processing, loop structure for automation rules at this time. And even if there was, smart value, list iterator scoping may prevent accessing the data you need to preform the search / replace operations.
Longer answer:
Context is important for automation rules. Would you please describe what problem are you trying to solve? That is, "why do this?" Knowing that and seeing your complete automation rule may reveal other solution approaches.
In the meantime, the method you described chaining replacements may reduce potential errors and improve rule performance. For example:
{{issue.comment.last.body.replace(firstAccountIdString, firstReplacement).replace(secondAccountIdString, secondReplacement).replace(thirdAccountIdString, thirdReplacement)}}
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.