Script runner custome field select message?

최성택 SE그룹_글로벌Infra총괄_
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 28, 2021

hi. my name is choi 

 

 

recently i try to use scriptrunner plugn in. but as i'm a beginner, i have a problem

we use our own jira workflow and 

from 1step to 2step, user need to select custom field( this is call "GRADE" and

it has "None","A","B")

 

----this is what i want---

if user select "None" and try to move next step button click

show message "Select One Please"

 

if user select "A" and try to move next step button click

show message "Please Check"

 

i was trying to make it like this

select workflow step > validator > add validator > script validator > using simple script

but i don't know this is right or not

 

please help me

 

1 answer

2 votes
Antoine Berry
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 6, 2021

Hi @최성택 SE그룹_글로벌Infra총괄_ ,

I would advise to add a behaviour on the select list custom field and use this script : 

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

@BaseScript FieldBehaviours fieldBehaviours

def selectList = getFieldById(getFieldChanged())
def selectListValue = selectList.getValue()

switch(selectListValue){
case null : selectList.setError("Please select a value"); break;
case "A" : selectList.clearError(); selectList.setHelpText("Please check"); break;
default: selectList.clearError(); break;
}

This way, if the user select : 

  • None : The message "Please select a value" will be displayed and the user cannot validate
  • A : The message "Please check" will be displayed and the user can validate
  • B : Nothing is displayed.

Hope that helps.

최성택 SE그룹_글로벌Infra총괄_
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 14, 2021

it works!!!

thank you so much!!

Antoine Berry
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 17, 2021

Hi @최성택 SE그룹_글로벌Infra총괄_ ,

Please mark the answer as accepted if you are satisfied with it so it can help other users too. :)

Suggest an answer

Log in or Sign up to answer