Forums

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

How to add customer-specific serial numbers in issues

C.G.
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 8, 2019

We have multiple customers and I need to be able to add a customer-specific serial number to each issue added for each individual customer.  Each customer must have their own sequential serial numbers that identifies who the customer is and the customer-specific development item number.  Ideally these need to be automatically generated.  Each customer-specific serial number needs to be unique.

This will help us track how many issues have been added for each different customer and act as a customer-specific development task or bug reference number.  

We have only recently started to use Jira (Cloud) for managing our software development, so it's a good opportunity to get things right from the start.

So far, I have manually added customer-specific serial number as a label, which consisted of 3 letters (based on the customer name), a hyphen and sequential numbers (e.g. THD-01, THD-01, etc.).  This hasn't worked as it:

  • Is open to errors and inconsistent labeling & risks not being a unique serial number
  • Resulted in many many different labels being created instead of a core set of labels
  • Is ineffective for searching
  • Is ineffective for tracking all development work carried out for individual customers.

I have also introduced a label naming convention to help us search and track issues by:

  • Customer name (or by our company initials if non-customer related)
  • customer-request (or internal if non-customer related)
  • product name/s.

Can anyone help please?  Thanks

2 answers

1 accepted

1 vote
Answer accepted
Thanos Batagiannis [Adaptavist]
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 Champions.
April 7, 2016

Hi vijay,

So you ask if there is a way to add a "condition" in the scripted field to check if the user who updates the issue, (and the updated field is 'connected' with scripted field) is an admin user. Unfortunately you cannot do that in your - responsible for the scripted field - script. Also the scripted fields cannot be updated directly but only via the fields that are 'connected' to it.

Therefore your question and please correct me if I am wrong, is how to allow only admins to edit specific fields in an issue and again this is not possible.
A workaround I can think is to associate a behaviour to the "suspicious" fields and make them read only if the user is not an administrator, for example

import com.atlassian.jira.component.ComponentAccessor
def groupManager = ComponentAccessor.getGroupManager()
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def field = getFieldByName("a field name")
field.setReadOnly(true)
if (groupManager.isUserInGroup(currentUser, "jira-administrators")) {
    field.setReadOnly(false)
}

Hope that helps, somehow...
Regards

 

1 vote
Kristian Walker _Adaptavist_
Community Champion
April 8, 2016

Hi Vijay,

I have enclosed below a sample Behaviour script which can be applied to the field read only. The script will check to see if the current user is in a group such as the jira-administrators group and if the user is in the administrators group then it will make the field writeable else it will be read only for all other users.

Below I have attached the code and config needed.

This code was developed and tested on JIRA 6.4.12 using ScriptRunner 4.1.3.10.

Code:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.util.UserUtil
  
// Get pointers to the custom field(s) required
def cf = getFieldByName("Demo Text Field")
  
// Get the current logged in user
def user = ComponentAccessor.getJiraAuthenticationContext().getUser().name
  
// Get a pointer to the admin group
UserUtil userUtil = ComponentAccessor.getUserUtil()
def group =  userUtil.getGroupObject("jira-administrators")
  
// By default make the field read only
    cf.setReadOnly(true)
  
if(userUtil.getGroupsForUser(user).contains(group)){
 // If the user is in the restricted groups field then show the field(s)
    cf.setReadOnly(false)
}

 

Config:

image2016-4-8 11:20:51.png

I hope this helps.

Kristian



Vijay Sridhar
April 10, 2016

Thanks @Kristian Walker (Adaptavist)

Suggest an answer

Log in or Sign up to answer