Forums

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

Change Issue Type based on value of Single Select Custom Field

Alvin
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.
December 3, 2018

Hi All,

Can I change Issue Type on Create Issue Screen based on the value of Single Select Custom Field?

Scenario is if 1 is selected on Single Select Custom Field, Issue type changes to Service Request

if 2 is selected, issue type will change to Bug. 

tried using behavior but no luck. 


Thank you

1 answer

0 votes
Matthias Gaiser _K15t_
Community Champion
December 3, 2018

Hi @Alvin,

you could write a ScriptListener which listens to the Issue_Updated event. This script could then check for your custom field and adapt the issue type accordingly.

If you search for ways how to change the issue type with scriptrunner, you can also checkout this answer.

Having said that, it is important that your issue types share at least the same workflow, otherwise you'll most likely run into troubles in case you want to convert the issue and it is in a state which does not exist in the other workflow.

What is the reason why you don't change the issuetype directly?

Cheers,
Matthias.

Alvin
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.
December 3, 2018

Hi @Matthias Gaiser _K15t_ , Thank you for the very fast response. I want to change it real time , in front of the screen before a user creates the ticket, not after the creation, that's why I try to use Behavior. Is it possible? 

Alvin
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.
December 3, 2018

@Matthias Gaiser _K15t_ I have different workflow for those issue types, that's why I want to change issue type right on screen based on the value of single select custom field.

Matthias Gaiser _K15t_
Community Champion
December 3, 2018

Are you talking about a customer creating an issue via the JSD portal? (You have added the label jira-service-desk-server). Or a user creating an issue via the usual Jira create action?

If Jira: Why don't you let them simply choose the issue type directly?

If JSD: You can configure your request types and map the issue types to them accordingly. I'd recommend guiding the users with the request types to create the correct issue type in the end.

Alvin
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.
December 3, 2018

@Matthias Gaiser _K15t_ , I am talking about Jira Service Desk but  not the customer portal. the agent portal, he usual Jira create action

Alvin
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.
December 3, 2018

@Matthias Gaiser _K15t_ via this one on Jira Service Desk

try.jpg

Matthias Gaiser _K15t_
Community Champion
December 4, 2018

So, why don't you let your users choose the issue type instead of the select list?

If you still want to do it, maybe someone else can jump in with more knowledge about Scriptrunner behaviours - if the desired behaviour is possible.

Alvin
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.
December 4, 2018

I just want to ask if its possible, manipulating issue type based on the value of select list

Nic Brough -Adaptavist-
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.
December 4, 2018

You can do this on Server with Scriptrunner behaviours, but it will only really work for the plain create screen.

Educating the users, getting them to set the right issue type is the right approach.  I would also look at reversing the idea - instead of setting the type based on the list, set the list based on the type (and remembering to educate them about this too - "if you select type A, we will be setting the list to X")

Like Matthias Gaiser _K15t_ likes this
Alvin
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.
December 4, 2018

Hi @Nic Brough -Adaptavist-, can you check my code?

 

import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript

@BaseScript FieldBehaviours fieldBehaviours

def regressionIssueField = getFieldById(getFieldChanged())
def regressedVersionField = getFieldByName("Issue Type")

String regressionIssueValue = regressionIssueField.getValue()

if (regressionIssueValue == "Sample") {
regressedVersionField.setFormValue("Service Request")
} else {
regressedVersionField.setFormValue("Service Request with Approvals")
}

 

I add a single select field and put it a server-side script. but it does not seem to work. 

 

Can you help? thanks

Alvin
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.
December 5, 2018

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events