We are currently trying to upgrade from JIRA 6.2.x to JIRA 7.3. Currently we have especially with Script Runner some issues.
We have a function that on a specific transition a sub task will be created and a person that is filled out in a custom field should be the assignee of the new sub task.
For that we've put the following text into the "Additional issue actions" field:
import com.atlassian.jira.issue.CustomFieldManager import com.atlassian.jira.ComponentManager cfParent = com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName('Team Lead') parentMyFieldValue = transientVars["issue"].getCustomFieldValue(cfParent) issue.setAssignee(ApplicationUsers.toDirectoryUser(parentMyFieldValue))
In 6.2 it works flawless, in JIRA 7.3 we are getting several errors:
For Line 3: The variable cfParent is undeclared
For line 4: The variable parentMyFieldValue is undeclared / Cannot find matching method
For line 5: the variable parentMyFieldValue is undeclared / And 2x Cannot find matching method
Hopefully someone can help me
Thanks in advance
We're not yet compatible with JIRA 7.3. You can see the versions we are compatible with here.
Atlassian made some changes in JIRA 7 requiring you to change your scripts slightly.
Please try the following code for JIRA 7:
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.MutableIssue import com.atlassian.jira.user.ApplicationUser def issue = issue as MutableIssue def customFieldManager = ComponentAccessor.getCustomFieldManager() def cfParent = customFieldManager.getCustomFieldObjectByName('Team Lead') ApplicationUser parentMyFieldValue = issue.getCustomFieldValue(cfParent) issue.setAssignee(parentMyFieldValue)
Line 3,4 - you need def in front of the variable name otherwise the type checker will complain. Line 5 - setAssignee takes an com.atlassian.jira.user.ApplicationUser instead of a com.atlassian.crowd.embedded.api.User.
Please see here for more information about how to change your scripts for JIRA 7.
Hi Samir, try this:
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.MutableIssue import com.atlassian.jira.issue.fields.CustomField import com.atlassian.jira.user.ApplicationUser def issue = issue as MutableIssue def customFieldManager = ComponentAccessor.getCustomFieldManager() CustomField cfParent = customFieldManager.getCustomFieldObjectByName('Team Lead') ApplicationUser parentMyFieldValue = issue.getCustomFieldValue(cfParent) issue.setAssignee(parentMyFieldValue)
Its because cfParent was not strongly typed. Although you see an error in the static type checker in these situations the script should still work.
Badges are a great way to show off community activity, whether you’re a newbie or a Champion.Learn more
A picture tells a thousand words. And agility boards have just released their latest feature: cover images on issues – so now your board can tell a story at first glance. Upload attachmen...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs