Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Script runner custome field select message?

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

0 votes
Antoine Berry Community Leader Dec 06, 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.

it works!!!

thank you so much!!

Antoine Berry Community Leader Dec 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
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you