Does any one know how to get value from the custom field "Team" which is created by Advanced roadmaps for Jira.
In JQL it runs with team id. When I try to use it in a workflow condition with Scriptrunner, its not working.
cfValues['Team']?.value == '45'
The question I raised is to achieve the workflow condition. Since the custom script not working, I changed it to validate via JQL. That made the condition to work as expected.
And, the script that worked
import com.atlassian.jira.component.ComponentAccessor def team = ComponentAccessor.customFieldManager.getCustomFieldObject(12345)
// replace this with your Team field id
def teamValue = issue.getCustomFieldValue(team)?.description?.title teamValue == "Test"
Thanks to Winnie from Adaptavist
Using Scriptrunner, I created the following script field
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Matt,
I am quite confused here.. What do you mean by Default Team?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
DeafultTeam is the class that you have to cast the value in the Team field as when you pull it out from the issue. I'm not sure why it was built that way, but that's how it works.
My guess is that is has something to do with the fact that all of this functionality used to be part of the Portfolio/Advanced Roadmaps plugin before it was integrated into Jira directly.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
groovy.lang.MissingMethodException: No signature of method: com.atlassian.jira.issue.fields.ImmutableCustomField.first() is applicable for argument types: () values: [] Possible solutions: print(java.io.PrintWriter), print(java.lang.Object), find(), find(groovy.lang.Closure), is(java.lang.Object), printf(java.lang.String, [Ljava.lang.Object;) at Team.run(Team.groovy:14)
It seems there is some error in getting the value..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you look in the list of custom fields, do you have a field called Team? I'm assuming you do, but want to make sure.
Also, in case it isn't clear, the "def teamField = " and "ComponentAccessor.getCustomFieldManager().getCustomFieldObjectsByName('Team').first()" should all be on the same line. It's just a limitation of the Community format that it looks like they aren't.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To make it more clear I get the field by custom field id... The field is accessible but somewhat its not retrieve the data values...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Matt,
Thanks for your time. I changed the condition script to work based on JQL. Its working fine.
Anyway I will try to work on this to extract the value from the Team field, probably via rest call.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The following works with custom field condition on a workflow:
import com.atlassian.jira.component.ComponentAccessor def team = ComponentAccessor.customFieldManager.getCustomFieldObject(12345) // replace this with your Team field iddef teamValue = issue.getCustomFieldValue(team)?.description?.title teamValue == "Test"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.