Forums

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

Want to capture first and later reassignments to a group in a scripted field.

SysAdmin
September 16, 2021

Hi,

This field was created to count the no of time the ticket was assigned to a group AA Service Desk. first assignment on creation is not getting captured, later changes are getting captured. What changes will be required here?

Whenever it is first assigned to this group on creation through automation or being preset as a value. It is not captured as a count. It is showing 0. It should count that as 1 and later routing to that group also.

This is the script written for a number field template scripted field but what changes will be required here to achieve the objective.

import com.atlassian.jira.component.ComponentAccessor
def data = 0

for(def his : ComponentAccessor.getChangeHistoryManager().getChangeItemsForField(issue, "Group Assignee")){
if (his.toString == "[AA Service Desk]"){
data = data +1
}


}
return data

 

Kindly advise.

 

Regards,

Muddassir Quazi

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Ignacio Pulgar
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.
March 19, 2019
I'd try substituting the escaped double quotes with single quotes. If that didn't work, then I'd try this:

Create a filter named Related with the JQL within your subtasksOf funcion.

Once you have that chunk of JQL saved as said filter, substitute that part in your original query with "filter = Related".

Therefore, your query would finally be:

issueFunction in linkedIssuesOfRecursive("issue = ROAD-166", "relates to") OR issueFunction in subtasksOf("filter = Parent") AND issueFunction in aggregateExpression("Total Worklog for all Issues", "TimeSpent.sum()")
TAGS
AUG Leaders

Atlassian Community Events