Forums

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

Change custom field value based on JIRA assignee group

kumar_ankush_in_bosch_com April 2, 2019

Hello Everyone,

I want to implement below requirement in my JIRA.

We want to change the custom field type select list values based on the user groups in JIRA.

Whenever assignee is changed and he is belongs to different group in JIRA. Custom field value should change.

1 answer

0 votes
Mohamed Benziane
Community Champion
April 8, 2019

Hi @kumar_ankush_in_bosch_com 

 

To achieve this you will need add-on, it's not possible natively in jira. You can look at https://marketplace.atlassian.com/apps/6820/scriptrunner-for-jira

This add-on allow you to add some code for your fields, workflow and more.

 

Hope this helps

kumar_ankush_in_bosch_com April 8, 2019

Hello Mohamed,

I have script-runner and trying to write script but fail to get value.

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.Issue

def groupManager = ComponentAccessor.getGroupManager()
def cfSelect = ComponentAccessor.customFieldManager.getCustomFieldObjectByName("CustomeField_name")
def cfConfig = cfSelect.getRelevantConfig(issue)
if(groupManager.isUserInGroup(issue.assignee?.name, 'JIRA-user-group2'))
{
def value = ComponentAccessor.optionsManager.getOptions(cfConfig)?.find {
it.toString() == 'Vlaue'
}
issue.setCustomFieldValue(cfSelect, value)
}

Deleted user April 16, 2020

I have the same scenario , when assignee is changed a custom field value should be changed/reset to null . I tried above solution and did not work using "issue assigned" custom listener . Can you please share if there is a solution on this . 

Deleted user May 18, 2020

@Mohamed Benziane : i am using Script runner and have the same scenario,   when assignee is changed a custom field value should be changed or reset to null . I tried above solution and did not work using "issue assigned" under custom listener . Can you please share if there is a solution on this ?

Suggest an answer

Log in or Sign up to answer