Hello!
I use listener (scriptrunner)
Events: issue updated
Task: I have 2 values 1. Dropdown selector (def field_2) 2. Multiple selecor (def field_3)
I need to do something like that
if ( CRM S or CRM M or CRM L in field_3) { field_2 = "не XS"}
else { field_2 ="XS"}
This is my script:
Hi @NewByatl,
I don't see any major error with this code except couple of warnings
1. what is the script doing now?
Does not update field_2 value at all?
or always goes to else part?
also I've modified script to clear that warning as below
def field_2 = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectsByName("Предварительный размер")[0]
//provisional size - dropdown selector
def field_3 = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectsByName("Размер (ы) заявки")[0]
//issue size - multiple value field
//this is find & fetch field options using it's value instead of string method
def optionValue = ComponentAccessor.optionsManager.getOptions(fieldConfig)?.find { it.value == 'XS' }
def optionValueNoXS = ComponentAccessor.optionsManager.getOptions(fieldConfig)?.find { it.value == 'не XS' }
and how about using if as below?
if ("CRM S" in newValueSize)
of course both are same. but just another try.
also can you pass your logged result to understand the current executions
Regards,
Leo
Greetings, Leo. Thank you, got it. Will be back soon with feedback!
PS: I find myself thinking - maybe I have another automation rule in script editor, which ruins my effort to successful complete this rule. I ll check it too.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm back.
what is the script doing now? answer: It always run ELSE-block (except i put in if block something like that: if (newValueSize.contains("CRM S").toString())
I have no idea why it happens, nobody can answer yet.
THanks for modif. i think it will be usefull, but it result is the same :(
and how about using if as below?
if ("CRM S" in newValueSize)
yea, I tried to use this construction. but it did not help (
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
below snippet will work at least
def isValue = false
newValueSize.each{
if(it.toString() in ["value 1","value 2"]){
isValue = true
}
}
if(isValue){
//if part code here
}else{
//2nd part here
}
BR,
Leo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.