It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

I want to fetch two field the ticket creation date and the closure date which is a custom field

Field1 - Creation Date

Field 2 - Closure Date

*****************************My Script**************************

// Define a JQL query for the issues on which you want to copy custom field values
def query = 'project = ATIT'

// Here you can specify the names of the fields you want to copy from and into
def sourceFieldName = 'Ticket Initiation Date'
def targetFieldName = 'Ticket Closure Date'
// We retrieve a list of all fields in this JIRA instance
def fields = get("/rest/api/2/field")
assert fields.status == 200

List<Map> allFields = fields.body
// Now we lookup the field IDs
Map sourceField = allFields.find { == sourceFieldName }
Map targetField = allFields.find { == targetFieldName }

assert sourceField : "No field found with name '${sourceFieldName}'"
assert targetField : "No field found with name '${targetFieldName}'"






GET /rest/api/2/field asObject Request Duration: 700ms
[id:customfield_10100, key:customfield_10100, name:Ticket Initiation Date, custom:true, orderable:true, navigable:true, searchable:true, clauseNames:[cf[10100], Ticket Initiation Date], schema:[type:datetime, custom:com.atlassian.jira.plugin.system.customfieldtypes:datetime, customId:10100]]
[id:customfield_10109, key:customfield_10109, name:Ticket Closure Date, custom:true, orderable:true, navigable:true, searchable:true, clauseNames:[cf[10109], Ticket Closure Date], schema:[type:datetime, custom:com.atlassian.jira.plugin.system.customfieldtypes:datetime, customId:10109]]


I want to calculate the turn-around of the ticket which will be third field.

TAT = (Ticket Closure Date - Ticket Creation Date)

How can query the results in the project and perform calculation


0 answers

Suggest an answer

Log in or Sign up to answer

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you