So I have a use case where I want to Slack message each user for a multi-user field to request them to action an item.
I have this working with Single user fields through requesting the User ID from slack and then formulating another web-request to my Slack bot that messages them. This works.
However when it comes to Multi-user fields I should be able to use the advanced branching component to get each of these users, but the smart value variable doesn't seem to be making it to be injected in my web request as it does with single user fields.
Using logging I know I can log the email addresses for each user of my "Stakeholders" field however using that variable is not allowing me to inject it into my web request.
I suspect I am structuring the advanced branching Smart Value incorrectly to allow it to loop over properly.
I've looked at the support documents for lists and have tried multiple different iterations but think I need help or have otherwise hit a bug.
Thank you
Hi @Andrew King -- Welcome to the Atlassian Community!
Your advanced branch is iterating over the selected users for the field, and those will each be a user object.
In your write to the audit log, you are correctly referencing the emailAddress attribute, but in your send web request you are passing the entire user object. Try changing the web request to only pass {{Stakeholder.emailAddress}}
Some other things I noted:
There is a typo in your write to the audit log for the smart value: {{shakeholder.emailAddress}} should be {{Stakeholder.emailAddress}}
Next, when naming variables (such as for branches and created variables) I recommend adding a prefix to ensure they do not coincidentally match an issue field. For example, varStakeholder rather than Stakeholder. As your variable and field only differ in one letter (i.e., the last "s") a typo could cause errors.
Finally, as your advanced branch is only using the email address, the branch could be changed to only use that field as a source: {{issue.Stakeholders.emailAddress}} No need to change this; just an FYI.
Kind regards,
Bill
Hi Bill having some trouble replying to your comment
I've made those recommended changes and fixed the typo and rechecked.
Smart Value is now = {{issue.Stakeholders.emailAddress}}
Variable name = varStakeholder
It's correctly writting to the audit log, but still not injecting into the web request. Any additional help is greatly appreciated
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I wonder if the cause is a URL encoding issue for the Slack REST API call. Please try changing the request URL to use this for the stakeholder value:
{{varStakeholder.urlEncode}}
https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#urlEncode--
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.
Just to confirm when you write the {{varStakeholder}} smart value to the audit log inside of the branch, you see the email address. Correct?
And if you write the entire URL for your request to the audit log (copying it directly from the "Web request URL" field in the action), does it look as you expect?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Success.
So whilst the Web Request Validator doesn't appear to work for For Each: Smart Value. I was actually logging the incorrect Response:
{{webResponse.user.id}}
When it should have been: {{webResponse.body.user.id}}
Thank you very much for your help. Human error by me for the most part!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Awesome; I am glad to learn it is working!
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.