Forums

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

Set assignee based on custom field value(radiobutton)

Rachid Amajoud May 18, 2018

Hi,

 

i created a custom field (radiobutton), based on the users choise i would like to set the assignee! Can i use Script runner for this setup?

 

grtz

Rachid

3 answers

0 votes
Rachid Amajoud June 7, 2018

Daryal,

how do I link the radiobutton value with the case, because the case depends on the value of the radiobuton.

 

grtz

Rachid

0 votes
Danyal Iqbal
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 18, 2018

yes. is this going to be part of a workflow transition? You can write a small post function to accomplish this or fire an event on this transition which you can catch in the listener to get the value of the custom field , perform your logic and set the assignee.

Rachid Amajoud May 22, 2018

It should not be a part of the workflow! Can I work this out with scriptrunner?

Danyal Iqbal
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 23, 2018

Yes, this use case is perfect for scriptrunner. You would need basic groovy to figure this out in less than 10 lines (See scriptrunner documentation for a bunch of awesome examples and code snippets.)

Rachid Amajoud May 23, 2018

hx for the feedback!

This is my script, but how can I get de value of a radiobutton from a custom field?

import com.atlassian.jira.component.ComponentAccessor

import com.atlassian.jira.issue.MutableIssue

String userName;

switch(ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Afdeling").toString()){

    case "AB": userName = "Sam";break;

    case "CD": userName = "Sam";break;

    case "EF": userName = "Peter";break;   

    case "GH": userName = "Peter";break;

}

issue.setAssignee(ComponentAccessor.getUserManager().getUserByName(userName))

Danyal Iqbal
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 23, 2018
def customField =  ComponentAccessor.getCustomFieldManager().getCustomFieldObject(<10301L>);
final Object customFieldValue = issue.getCustomFieldValue(customField)

something like this  to get the custom field by id.

Rachid Amajoud May 24, 2018

@Danyal Iqbal thx! I'll try this!

 

grtz

R.

Rachid Amajoud June 7, 2018

Hey Danyal, can you help me working this out? 

grtz

Rachid

0 votes
Yogesh Mude
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 18, 2018

Hi @Rachid Amajoud,

yes, Using scripted post function you can do this. you need to capture the value of the radio button field and set the assignee.

Rachid Amajoud May 22, 2018

Can I work this out with scriptrunner?

Suggest an answer

Log in or Sign up to answer