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

JIRA Ultimate Role Tracking & Estimation - REST API/Workflow Options

Marc Fukuda May 15, 2017

There are a few things I am trying to do here:

*  Set default estimates by role based on a custom field value.  I can do this with the set/get estimate REST API.  I would ideally like to do this in the workflow or script runner though.  In script runner, I was unable to figure how to update the estimates by role.  The was no class to add for the object type that needed to be updated.

* If we have developer role that is not assigned to an issue and the user in that role changes to status to indicate development has started, that user should be set as the developer.  I need a workflow item to assign a user to a role based on other conditions.  If there were REST API options to set/get assignee by role, I could at least get this functional.

* Some users can be a developer role or tester role on issues.  I need workflow item to prevent a transition if the 2 specific roles have the same assignee.

2 answers

0 votes
Abhinav Ojha May 17, 2017

Hi Marc,

1) We don't have any functionality that could connect things with script runner. We can still add a post function to the workflow, which can help you with this. If you can elaborate, how exactly you need this to be, we will put it under development.

2) For assigning a user to a role automatically on transitions, we have a post function which can help you with it. (Please see the screenshot).

3) To prevent transition in such cases, we can look into adding a condition item for workflow, that can help you with tis.



Abhinav Ojha May 17, 2017


Marc Fukuda May 17, 2017


I saw those post functions, but they are not exactly what I need.

#1 - Here is what I would need.  Based on the value of a configurable custom field or standard field, assign an estimate to each role.

For example:

I have custom field Feature.  If the value is Feature A, I want to assign role Developer 2 hours and role Tester 1 hour.  If the value is Feature B, I want to assign role Developer .5 hours and role Tester 3 hours.

#2 - I am not talking about changing the standard Assignee field, although I will still use that post function.  I am talking about setting the Assignee by Role for a specific role.

For example:

If I have 3 roles Developer, Tester, Reviewer.  Tester and Reviewer have been assigned, but Developer has not.  When a user moves the issue from Not Started to Coding, the current user should be assigned to the Developer role.  This needs to be configurable to assign to which role is needed for the transition.  The purpose of this is to ensure each role is filled out when the issue is complete, without explicitly needing to set the role manually.

#3 - I use JIRA Workflow Toolbox for a lot of custom checks.  I was hoping to be able to get a little bit of that functionality.  Just simple work flow validator to compare 2 roles either to each other or specific values should be all I need.


I greatly appreciate the response!

Abhinav Ojha Jun 13, 2017 • edited

Hi Marc,

Sorry for the late reply, but please be rest assured, we are putting all your requests in our roadmap and will try to get these up as soon as possible.



0 votes
Neha Sharma Jul 26, 2018

Hi Abhinav,

I have a doubt related to role based estimations. So we have custom fields called Developer, QA, Tester, Reviewer, Product manager etc. Whenever someone creates an issue,  the creator gets the option to set these custom fields. Now the value of this custom field is used by us to change the assignee based on the workflow changes. Whenever the workflow is changes, we change the assignee name based on the custom field (one of the above) depending on the workflow status. This we do using a SIL script and it works perfectly fine for us.

We started using this Role Based Estimations currently and what we want to do is that whenever any user edits a issue (for us, its Project/Epic and only Project managers can do that), then we want to populate the Roles by taking values from the above custom fields. 

Is it possible to achieve this anyhow, from the UI or from the script ? 

Attaching a screenshot for reference - Capture.PNG



Abhinav Ojha Jul 26, 2018

Hi Neha,

I am not sure about using a script to update values of one CF from another CF,  (you could look up about it in Groovy Scripts). You can take a look at how our CF values are saved in the DB and go ahead from there.

Another way could be, that you can have default assignees for each role, for each of the issue types, which will depend on how you configure our plugin. This way you will have the assignees for each role be auto-filled with most commonly assigned people.

You can always use the post functions I explained in this thread, to use the role-based assignee to assign the issues during a transition, automatically.

Thank You,


Neha Sharma Jul 27, 2018

Hi Abhinav,


Is there a way to update "Assignee by Role " custom field using rest-api, groovy , sil or any other coding language?



Abhinav Ojha Jul 29, 2018

Hi Neha,

In the next release, we will add a REST API for you to do a post and update the assignees by roles field.

If you want to use groovy, then get the assignees custom field using its id and follow explanation on how to set a CF value using groovy :

Using Groovy to set CF value

Note that CF value will be stored in the format as in the example given below:

[10002###abc, 10029###xyz]

The data will be a collection of, roleId###userkey

Thank You,


Neha Sharma Jul 30, 2018

Hi Abhinav,

Thanks for the reply. I tried the solution you suggested. Yet I get this error when I execute the groovy.

java.lang.String cannot be cast to com.adweb.estimations.customFields.assigneesByRole.Assignee

Below is my code snippet - 

def cField = customFieldManager.getCustomFieldObject("customfield_11111")
def issue = issueManager.getIssueObject("ABC-123")

def changeHolder = new DefaultIssueChangeHolder();
def cFieldValue = issue.getCustomFieldValue(cField)
def assigneesList = ["10001###abc", "10002###xyz", "10003###jkl", "10004###mno"]
cField.updateValue(null, issue, new ModifiedValue(cFieldValue, assigneesList), changeHolder);

I tried importing the class "com.adweb.estimations.customFields.assigneesByRole.Assignee" so that I can create the list accordingly, but I'm unable to do so too.




Abhinav Ojha Jul 30, 2018

Hi Neha,

As we cannot import a third party class this easily (probably not possible!), I have written a bit of a hack code. What my logic here is that you get the class of the return value of the custom field and then create a new instance of it and update the field. This works when you don't have a null value for the set field (probably use an issue which has some value stored to get the class).

In the below code, return field value is a list of the com.adweb.estimations.customFields.assigneesByRole.Assignee class, so I iterated over it and got the class in a variable and then created new instances of the class with my values (the constructor of this class is Assignee(String roleId, String userKey))

Hope this helps.

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.web.bean.PagerFilter
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import java.util.ArrayList

def cField = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_10108")
def issue = ComponentAccessor.getIssueManager().getIssueObject("TP-20")

def changeHolder = new DefaultIssueChangeHolder();
def cFieldValue = issue.getCustomFieldValue(cField)

def assigneesList = new ArrayList<>()

def assigneeByRole

for (Object item : cFieldValue) {
assigneeByRole = item.class

def assigneeByRole1 = assigneeByRole.newInstance('10002', 'xyz')

def assigneeByRole2 = assigneeByRole.newInstance('10100', '')

cField.updateValue(null, issue, new ModifiedValue(cFieldValue, assigneesList), changeHolder);
return assigneesList;


Try this (you can customize it as per your need) and if this doesn't work out for you, we will look into creating a REST API for it. 

Note that a blank user key (assigneeByRole.newInstance('10100', '')) will clear the assignee for the role.


Neha Sharma Aug 07, 2018

Hi Abhinav,

Sorry for the late reply. But the last solution provided by you worked wonders for me and I was finally able to implement the requirement using the same.

Thanks a lot.


Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Marketplace Apps & Integrations

Webinar alert! An IT Admin's Guide to Securing Collaboration at Scale

Hello, Atlassian Community! My name is Dave Meyer and I'm a Principal Product Manager at Atlassian. I wanted to give this community a heads up about an upcoming Webinar that might be of interest...

167 views 2 7
Read article

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