Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Extracting a number from the issue summary

Marcus Jones
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 7, 2023

I have a use case where I am sending in emails to Jira service management to create tickets. Those emails will have multiple attachments and I want to add a system where I can count the # of attachments as the # of tasks. Kind of like a weighting system i.e. One task may have 3 attachments so it's weighted as 3 vs a task that only has 1 attachment weighted as 1. I am appending the # of attachments in the email subject line in a standard way which flows into the summary of the Jira ticket. My question is how do I extract that number from the summary so I can use automation to apply it to a custom field I created?

2 answers

2 accepted

0 votes
Answer accepted
Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 7, 2023

Hi @Marcus Jones - another option is to simply count the number of attachments, using the smart value: {{attachment.size}}

The trick is that the "Issue Created" trigger will probably fire before all of the attachments are attached.

Yup - the first time I did this I got 0.

So I pulled the old "Re-fetch issue data" trick and that seemed to do it:

Screen Shot 2023-03-07 at 4.11.54 PM.png

It'd probably be good to have some kind of keyword or something in the Subject/Summary to make sure we know it's an issue coming in via email instead of directly in Jira.

Oh, and you'll want to test with big attachments, etc. to make sure it's always getting the count right, regardless of file size, etc.

Marcus Jones
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 8, 2023

I really like this way of doing it as well actually, it makes it so I don't have to append the # of attachments in the summary field keeping it cleaner. Issues come into this project only via email so I shouldn't have an issue with issues being created by agents or in the portal. 

Thanks for the help!

0 votes
Answer accepted
Mohamed Benziane
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 7, 2023

Hi,

Welcome to the community

You can try to use the substring function with Automation

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/

Marcus Jones
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 7, 2023

This was helpful thank you! I ended up surrounding the # with * and used this expression to extract:

{{issue.summary.substringBetween("*","*")}} 

Like Mohamed Benziane likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events