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.
This works fine, but the maintenance is painful. As the list grows, it gets more difficult to find things and make changes (because of so much repetition, the fields are short and don't allow me to see the values well, etc.). Is there a smarter way to do this?
What I have tried
I tried a couple of things involving the advanced branching, to later realise it runs in parallel and whatever is done in the branch is lost. The replacements made in the loop didn't affect the variable {{message}}. I see the reason for performance purposes, but it doesn't make sense to me not having a plain and normal synchronous loop.
I tried having all values in a Lookup Table component, and managed to iterate over them. I also tried to use slip() to break a string that contains all data colon-and-semicolon-separated: "user1-jira-account,user1-slack-id;user2-jira-account,user2-slack-id;" (and so on). Both ways worked for me, but I can't find how to update the message without repeating the call to .replace a multiple times.
Has anyone tried something similar? Ideas to share?
Thanks and regards
Paulo