I am trying to create my first code / script in Script runner for Jira Cloud but I am 3 months in and not succeeded yet. (Obviously, I have little to no coding experience)
I have a workflow in a project and I am trying to create a post function that emails a specific user once an issue has passed through this transition (which happens to be an escalation transition from 'waiting for support' to 'Escalated'). I have a working code that currently posts the name of the person and the relevant comment but it isn't 'tagging' the user. So it doesn't send them a notification. Is anyone able to tell me what I am missing, below is my code which is running in the post function:
final JOE_BLOGGS_ACCOUNT_NAME = "JOE BLOGGS"
Hi George,
Thank you for your question.
I can confirm the easiest way to see what value to set is to manually add a comment on an issue and then use the script console to make an API call to the Get Comments For Issue API to see what structure an at mention is stored as.
I have done this and see it stored like below, where you specify the user's account.
[~accountid:1234-3423432423-32423-234324324]
Using this, I have updated your comment text to use this structure and can confirm it added a comment with an at mention as require.
You will just need to update the accountId value to be the accountId of a user inside your instance.
I hope this helps.
Regards,
Kristian
Hi Kristian,
That has worked wonders, thank you so much. I have looked at that 'Get Comments For Issue API' link. Are you able to just tell me the script you put in the console to get the comment details to return?
I have not used the console and when I pasted the example on the right and changed it to my issue I got red errors.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi George,
To get comments for an issue you can run a script similar to the script I have created here.
I hope this helps.
Regards,
Kristian
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.