Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Auto incremental custom field based on ticket creation

Prathap DL August 21, 2025

Hi Community,

 

I have a requirement in Jira Cloud where I need a custom field (let’s call it Document Number) to automatically increment every time a new issue is created.

 

For example:

 

  • When the first ticket is created → Document Number = 6000
  • Next ticket → Document Number = 6001
  • Next ticket → Document Number = 6002
    …and so on.

Is there any way that can I achieve this?

Note: We are using jira cloud

 

2 answers

0 votes
Pedro Olmo
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.
August 21, 2025

Hello @Prathap DL ,

 

To do this, you'll need to use an rule automation to retain the created issue.key every time a new ticket is opened. Once you have this data, you can make a web request to get the ticket issue.key - 1 (previous ticket). With that REST API call, you obtain the custom field you want to increment by 1 from the webresponse.body. The last part is an action in the automation to edit that field in the created(trigger) ticket.

regards 

Prathap DL August 21, 2025

hi @Pedro Olmo 

Thanks for the answer.

As I'm new to this Jira automation, could you please provide the working automation rule? 

Like Mario GELES likes this
Pedro Olmo
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.
August 22, 2025

Hello @Prathap DL ,

 

I will prepare it for you but keep in mind that you will need to have an access token from a user via REST API. You will also need the custom field number.

Manage API tokens for your Atlassian account | Atlassian Support

 

Regards

Pedro Olmo
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.
August 22, 2025

Hello @Prathap DL ,

 

I’ve just created the automation and I’ll be explaining it to you step by step. First of all, I want to mention that I like working with variables in automations, so I’ll be showing you the variables I created and what each of them does.

 

  1. Trigger: When Work item created.
  2. Condition: If project = your project (In my example project is Proyecto Formacion)
  3. Create variable {{Key}} = {{issue.key.split("-").last}}  This variable stores the number of the newly created ticket.second.png
  4. Create variable {{project}} = {{issue.key.split("-").first}}  

    With this variable, I capture the project key.tercero.png

  5. Create variable {{previouskey}} = {{#=}}{{Key}} - 1{{/}} Here, I want to subtract one from the current ticket number in order to get the previous ticket number, then go to that ticket and look up the value of the Document number cuarta.png
  6. Send web request: https://yoursite.atlassian.net/rest/api/3/issue/{{project}}-{{previouskey}}  Here I make a REST API call using the previous ticket number (the one created before) to obtain the value of the Document number.  Remember API Token with your user:Manage API tokens for your Atlassian account | Atlassian Supportquinto.png
  7. Create variable  {{DocumentNumber}} =  {{#=}}{{webResponse.body.fields.customfield_11320}} + 1{{/}}  This variable retrieves the value returned by the REST API call from the field customfield_11320, which in my setup corresponds to my custom field. In your case, it will be the Document Number field. I increase this value by one so that it can be added to the newly created ticket.seis.png
  8. Edit workitem field with {{DocumentNumber}} Variable. siete.png

 

Here I’m sharing an overview of the entire automation I explained above. I hope the explanation works well for you. Let me know if you have any questions.

todopng.png

 


Regards

 

 

 

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.
August 22, 2025

Hi @Pedro Olmo 

I respectfully and strongly suggest not Creating Variable names with ones matching existing fields / smart values.  That is likely to confuse people reading the rule and the rule logic. 

For example, when there is an issue in scope, the rule could confuse {{issue.project}} and {{project}} (the variable) because when an issue is in scope, {{issue.project}} and {{project}} are the same thing.

 

One way to avoid this problem is to always and consistently add a prefix to variable names which is unlikely to collide.  For example, using varProject rather than project.

 

Kind regards,
Bill

Prathap DL August 25, 2025

Hi @Pedro Olmo 

Thanks for the support. We will try this and update to you.

 

0 votes
Mario GELES
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.
August 21, 2025

Hi @Prathap DL 

I don't know if it could help you but you can use the smartvalue increment in an automation to add +1 to a value.

Like this : 

{{#increment}}4{{/}}

-> add 1 to 4 so in your customfield you could see 5

You can also reference a numeric field so it would be : 

{{#increment}}{{issue.MyReferencedField}}{{/}}

Suggest an answer

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

Atlassian Community Events