Assign an issue to an user using issue's summary

Alejandro Moreno April 1, 2024

Hi,

We are using an email to create issues in jira. Those emails have as subject "TITLE#Issue title#USER$anuser@email.com$".

Then we have an automation that triggers when an issue is created, if the subject contains an "@", then:

- Adds a customer to the project using "{{{issue.summary.substringBetween("USER$","$")}}}"

-After that, I want to assign also the new issue to the user that has the email written in the summary, I am using this code but it is not working:

{
"set": {
"assignee": {
"set": "{{{issue.summary.substringBetween("USER$","$")}}}"
}
}
}

 

I think I need the accountID of the user in order to assign the issue to him, I tried sending this web request, but it is not working, I get a "bad request 400":

 

Webhook URL: https://<put-your-sitename-here>.atlassian.net/rest/api/3/user/search?query={{issue.summary.substringBetween("USER$","$").urlEncode}}

 

Can anyone tell me if I am missing something? Thank you in advance.

Regards

3 answers

1 accepted

1 vote
Answer accepted
Kalyan Sattaluri
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 1, 2024

Hello @Alejandro Moreno 

Everything seems logical including the endpoint to get the account ID. so unless we see Audit logs we can only suggest steps and ask what response you are seeing.

  • Have your tried without the urlencode inside smart value?

https://<put-your-sitename-here>.atlassian.net/rest/api/3/user/search?query={{issue.summary.substringBetween("USER$","$")}}

  • In your browser, when you put below URL for a sample email address, are you seeing response?

 https://<put-your-sitename-here>.atlassian.net/rest/api/3/user/search?query=myemail.com

  • In your automation rule, when you log {{issue.summary.substringBetween("USER$","$")}} are you seeing the email getting extracted correctly?
  • In your automation rule, when you log below string, is it getting rendered correctly?

https://<put-your-sitename-here>.atlassian.net/rest/api/3/user/search?query={{issue.summary.substringBetween("USER$","$")}}

Alejandro Moreno April 2, 2024

Hi @Kalyan Sattaluri ,

Thank you for your reply, I will answer you below:

  • Have your tried without the urlencode inside smart value?

Yes, and same outcome, "bad request 400"

  • In your browser, when you put below URL for a sample email address, are you seeing response?

Yes, I get the correct response from the browser with that url.

  • In your automation rule, when you log {{issue.summary.substringBetween("USER$","$")}} are you seeing the email getting extracted correctly?

Yes, the email is extracted correctly.

  • In your automation rule, when you log below string, is it getting rendered correctly?

It is not, the string is logged as it is written, not the response. I attach an image:

action logs.png

Alejandro Moreno April 10, 2024

Hi,

It was an error in the web request's authorization header. I fixed it and now it works.

Thank you

Like Kalyan Sattaluri likes this
0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 2, 2024

Hi @Alejandro Moreno 

For a question like this, please post an image of your complete automation rule, images of any relevant actions / conditions / branches, an image of the audit log details showing the rule execution, and explain what is not working as expected.  Those will provide context for the community to offer ideas.  Thanks!

Until we see those...

When dynamically building a URL for the Send Web Request action, any errors or timing problems could lead to errors.

I recommend:

  • first build and save the desired URL completely in a Created Variable, perhaps named varUrl
  • writing that variable to the log to confirm it, with {{varUrl}}
  • and then using the variable as the URL for the Send Web Request action.

This approach will also solve any timing problems to fully define the URL before it is used.

Kind regards,
Bill

0 votes
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 1, 2024

Hello @Alejandro Moreno 

You added tags to your post to indicate this is for Jira Service Management. Can you confirm that you are creating issue in a Jira Service Management project from email?

If that is true, are you using the native Jira Service Management email processing, or some different process to create the issues?

Do I understand correctly that you are create a Jira Service Management Customer user account from the information in the Summary of the email? And you are creating that account based on the information in the Summary that appears in the place indicated by anuser@email.com?

Do I understand correctly that you are then trying to set the Assignee field of the issue to the Customer you created? If so, that is not allowed. You can set the Assignee field only to licensed JSM Agents. You cannot set the Assignee to a user who is only a Customer of your JSM instance. You can instead set the Status of the issue to something that indicates that the Customer needs to provide information.

Alejandro Moreno April 1, 2024

Hi @Trudy Claspill ,

Thanks for your reply. Yes, I am creating the issues in a JSM project (team managed), and I am using the native JSM email processing.

The emails written in the summary will belong to licensed JSM agents, so that should not be the problem

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events