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

Custom Field with Auto Generated Value

Dearka Chan October 12, 2023

Hi Community.

Right now I'm using Service Management free plan. I would like to create a custom field with an auto generated value for my issues. The value I want is a series of number combined with the date and the number of issue key. 

I want to value would be YYMMXXXX (Y=year, M=month, XXXX=number part of the issue key). For example, today is Oct 2023 and the issue key of the newly created issue will be ABC-5, then the value in the field will be 23100005.

Is it possible to be created? (even with JQL or other programming method)

Thank you.

1 answer

1 accepted

3 votes
Answer accepted
Tim Kopperud
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 12, 2023

Hi @Dearka Chan 

You can du this with Automation and apply this to your custom field

{{now.format("yyMMdd")}}{{issue.key.split("-").last}}

Here is an example of such rule. Notice I used the Summary field, but you shuld change that to your customfield. 

split.png

The result will be like this:

splitRes.png

Edit:

I now see that you don't want the day. Simply remove "dd", so it is like this:

{{now.format("yyMM")}}{{issue.key.split("-").last}}

Notice MM must be capitalized.

 

TimK

Dearka Chan October 12, 2023

Thank you, it really helps a lot. By the way, if I want to recalculate the issue number in the start of every month, can the last part of the value changed from the number part of issue key to the issue number of this month? 

For example, the next issue is the 6th issue in this month, can the value be 23100006?

Like Tim Kopperud likes this
Tim Kopperud
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 12, 2023

Hi @Dearka Chan 

I see. Change the rule as shown below.

lookupSummary.png

You will need to find all issues created in this month and then use lookupIssues which will contain those issues. Then you can use the smart value function size to fetch this "counting number". Adjust the smart value formula to this: 

{{now.format("yyMM")}}{{lookupIssues.size}}

TimK.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events