Reputation: 262
I have issues in Jira, and the issues have assignees. Can I calculate the value of a custom field base on those assignee's names? I.e, if assignee= name1, name2 or name3, set custom field value to Entity1, and if assignee = name4, name5 or name6, set the field to Entity2. I want this to be changed automatically each time an assignee from corresponding entity is assigned.
Upvotes: 0
Views: 3870
Reputation: 17846
If you want the change to be made when making a workflow transition, use Jira Script Runner plugin to add a post script function:
import com.atlassian.jira.ComponentManager
cf = customFieldManager.getCustomFieldObjectByName("Custome field name")
# get the current assignee
assignee = issue.getAssignee().getDisplayName()
if (assignee == 'John Doe'):
# set vustome field
issue.setCustomFieldValue(cf, "content")
else:
.....
If you want it the custom field to change the same moment the user changes the assignee, you can add an AJS script to the assignee field description, let me know if you wand a code for that.
Upvotes: 1