Forums

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

Is it possible to implement a counter in a task?

Manuel Navarro December 21, 2022

As part of one of the innovation activities, my company has implemented Jira in a project as the manufacturing records SW.

 

We are using the system to adapt the task/bugs issue types to record the different steps of the production. And the Sn of each maachine is manually specify in the summary of the task.

 

Could it be possible to implement a counter or a formula so the SN is automatically assigned or at least so it could not be duplicated by mistake?

1 answer

1 accepted

0 votes
Answer accepted
Ste Wright
Community Champion
December 23, 2022

Hi @Manuel Navarro 

Can I clarify the issue here.

Is it that there should never be a duplicate SN in the Summary field? So no two Issues should have the same SN?

If yes, what is the consequence of this happening? And when does the consequence take place in the workflow?

Ste

Manuel Navarro January 2, 2023

Hello Stephen,

 

Exactly, the identifier of the instruments (aka Serial Number) should never be duplicated. Even though the first 5 digits of the SN is the same, then it is followed by the consecutive number following the one assigned in the previous machine (plus in-between as many 0s as needed to complete 9 digits in total).

 

For example, if the first 5 digits are 43210, then the first instrument’s SN would be 432100001 and the following manufacture would be 432100002. This information is manually written off in the summary field and we would like to automate it.

 

In case two machines have the same SN when creating the second task that duplicates the SN, there should be an error message once created, or preferably the task should never be possibly created in the first place. As this field is recorded during the creation of the task, the consequence is happening even before starting the workflow or in the first step if the only option would be a warning message when duplicating SNs.

Ste Wright
Community Champion
January 4, 2023

Hi @Manuel Navarro 

There's two rules here:

  1. Create the Serial Numbers
  2. Check for Duplicates

^ Based on the need, I do think exploring a scripted validator on the create transition, and potentially a scripted post-function would be better. But this functionality isn't natively available - you'd need an App like Scriptrunner to make these possible to explore.

---

Rule 1 is difficult to do via Automation - I've not found a great way to do this so far.

Rule 2 though I found an option - see below.

---

Rule 2 - Check for Duplicates:

  • Trigger: Issue Created
  • Condition: JQL Condition
    • JQL = Summary ~ "{{triggerissue.Summary}}"
  • Action: <<Action Here>>

A few notes on this rule...

  • The Trigger cannot be pre-issue creation - so the duplicate is still created. To set it pre-creation it'd need to be a workflow validator (see above on scripting)
  • The Condition assumes only the serial number is in the Summary - or the other wording is the same on every other issue. If this isn't the case, I'd consider adding the serial number to its own custom single-line text field - to make it easier to check
  • The Action could be anything you want it to be - for example...
    • Comment on Issue, requesting the user adds a unique serial number
    • Transition Issue to Done, and set resolution as duplicate
    • Move Issue to a separate Project, to quarantine it
    • Delete Issue
    • ...etc
  • ...I would notify the user though depending on the action - either via a comment, or an email

---

Let us know if Rule 2 works for you - and if you have access to a scripting App, that'd be great!

Ste

Manuel Navarro January 10, 2023

Thank you so much @Ste Wright .

 

I will transfer this information to our developing team. I am sure this will be of great help to support the process.

Like Ste Wright likes this

Suggest an answer

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

Atlassian Community Events