Dear People,
I am really newbie writing workflow. I need a condition while creating an issue.I have a selective dropdown customfield values as A or B. Then I have another dropdown customfield values as "A_XYX" "A_TVY" "B_CVY" "B_TVZ"
When I select "A" from the first customfield then I can only select "A_XYX" or "A_TVY"
If this not meet then I need a message like "You can not select "B_CVY" or "B_TVZ" when the first custom filed selected as "A"
If you are using WF to achieve your ask, then essentially you will need to add "validator" to your WF's transition step, so one cannot complete the WF transition if there is a mis-match between your two custom fields value.
I don't believe a WF is the right approach for your situation. Currently, you should take a look at the following paid add-on -
https://marketplace.atlassian.com/apps/6820/scriptrunner-for-jira?hosting=datacenter&tab=overview
Where it has a component named "Behavior"and you can setup option control of a field based on another field's value selection to configure the setup.
Hopefully this helps + your organization already have migrated your Server env to either Datacenter or Cloud env because the Server env will be de-supported by Atlassian on Feb 2024.
Best, Joseph Chung Yin
Jira/JSM Functional Lead, Global Technology Applications Team
Viasat Inc.
thank you Joseph,
We are on the way of Datacenter.
I have also script runner but I do not know how to realize:-) Is there any asked and solved
on the community such a kind of my problem
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Since you are using ScriptRunner for Jira in your environment, please ensure that you take a look at setting Behavior configuration setup.
With Behavior configuration setup, you don't need to use the WF to achieve what you wanted.
https://docs.adaptavist.com/sr4js/latest/features/behaviours
Here is an example from ScriptRunner for Jira library using Behavior configuration - https://docs.adaptavist.com/sr4js/latest/features/behaviours
Hope this helps.
Best, Joseph
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have looked at the sites but could not find a smiliar solution for me.
Thx
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We have been using the Behavior component in our env extensively, so if you can provide me with more details of your needs, I can try to come up with the solution example to share with you as a start.
Best, Joseph
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.
Here is my script but it gives error ;
def Welches System = getFieldById("customfield_25108")
def Welcher Service/Betroffene Kachel = getFieldById("customfield_25203")
if(Welches System.getValue()){
def selectedOption = Welches System.getValue() as String
if(selectedOption == "MKH"){
Welcher Service/Betroffene Kachel.setHidden(true)
Welcher Service/Betroffene Kachel.setRequired(false)
}else{
Welcher Service/Betroffene Kachel.setHidden(false)
Welcher Service/Betroffene Kachel.setRequired(true)
}
}
what I am wanting if the customfield_25108 is as a value select "MKH" then my other cascade type customfield_25203 hidden(true) and requied(false)
the other options for my customfield_25108 ;
"None"
"NKH"
When selected value as "NKH" then customfield_25203 required(true)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What kind of error that your above script is throwing? Looking at the script, I recommend you don't use "/" character in variable definition. In addition, your variable definition also contains a space in the variable name - this is not allowed.
Try to change the "/" to "_" and replace the space character with "_" too see if your script will work or not.
Example -
Secondly, your outer if is not needed. You can just populate the selectedOption variable and use it for the if/else condition.
def selectedOption = Welches System.getValue() as String
if(selectedOption == "MKH"){
Welcher Service_Betroffene_Kachel.setHidden(true)
Welcher Service_Betroffene_Kachel.setRequired(false)
}else{
Welcher Service_Betroffene_Kachel.setHidden(false)
Welcher Service_Betroffene_Kachel.setRequired(true)
}
Best, Joseph
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have changed my script as Joseph's advise then it's working;
def WelchesSystem = getFieldById("customfield_25108")
def WelcherServiceBetroffeneKachel = getFieldById("customfield_25203")
if(WelchesSystem.getValue()){
def selectedOption = WelchesSystem.getValue() as String
if(selectedOption == "MKH"){
WelcherServiceBetroffeneKachel.setHidden(true)
WelcherServiceBetroffeneKachel.setRequired(false)
}else{
WelcherServiceBetroffeneKachel.setHidden(false)
WelcherServiceBetroffeneKachel.setRequired(true)
}
}
Thank you very much JC
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You are welcome and excellent that my inputs resolved your problem. For efficient coding you don't need the outer if statement in your script -
if(WelchesSystem.getValue()){
def selectedOption = WelchesSystem.getValue() as String
if(selectedOption == "MKH"){
WelcherServiceBetroffeneKachel.setHidden(true)
WelcherServiceBetroffeneKachel.setRequired(false)
}else{
WelcherServiceBetroffeneKachel.setHidden(false)
WelcherServiceBetroffeneKachel.setRequired(true)
}
}
Best, Joseph
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have saved this behavior script. Now I go to my WF and edit in"create" in validator.
How can I call this saved behavior?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is a setup for Behavior configuration for your project, you don't call this script within your WF's validators setup.
Best, Joseph
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.
What was the error message? Why don't you just use Scriptrunner's Behavior configuration to execute your action. You don't have to add it as a validator in the WF.
Best, Josehp
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am trying to create issue when I select "MKH" or "None" for "customfield_25108
the custom field customfield_25203 still appearing
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
def WelchesSystem = getFieldById("customfield_25108")
def WelcherServiceBetroffeneKachel = getFieldById("customfield_25203")
if(WelchesSystem.getValue()){
def selectedOption = WelchesSystem.getValue() as String
if(selectedOption == "MKH" || selectedOption == ""){
WelcherServiceBetroffeneKachel.setHidden(true)
WelcherServiceBetroffeneKachel.setRequired(false)
}else{
WelcherServiceBetroffeneKachel.setHidden(false)
WelcherServiceBetroffeneKachel.setRequired(true)
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The shortest way of my purpose is ;
customfield_25203 is the only required(true) & hidden(false) when the "customfield_25108" ="NKH"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Could it be something wrong while creating behaviour over behaviours screen?
I have done add mapping and selected for my project and issue type
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please read my previous suggestions -
1) In your code setup in Behavior configuration, you have extra calls which are not needed (remove the highlighted/strikethrough lines)
def WelchesSystem = getFieldById("customfield_25108")
def WelcherServiceBetroffeneKachel = getFieldById("customfield_25203")
if(WelchesSystem.getValue()){
def selectedOption = WelchesSystem.getValue() as String
if(selectedOption == "MKH" || selectedOption == ""){
WelcherServiceBetroffeneKachel.setHidden(true)
WelcherServiceBetroffeneKachel.setRequired(false)
}else{
WelcherServiceBetroffeneKachel.setHidden(false)
WelcherServiceBetroffeneKachel.setRequired(true)
}}
How did you setup your Behavior configuration? (via initializer or actual field with serverside scripting)
Best, Joseph
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
when the value "MKH" the other custom field(under) still appearing or when it is "None"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your update. In this case remove the initializer setup and move the script code against the "Welches System" field and add the script codes using "Add server-side script" option.
Best, Joseph
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yeah I found my mistakes;
1- There was a still requried validation for mycustomfield_25203
2- There ware many saved behaviours for mu purpose when I have deleted and created final one. Then it worked by JY's solution
Thank you very much JY again :-)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
BTW,
I have solved my problem without any script. Here is my solution just create cascade customfield
then put your 2 values or more.
then click configuration for your values then again fill in the other values So let say your master
customfields Values as A,B,C
then you want to select from other customfieds values depending on selecting from A,B,C
just go to cascade customfield and do configure for each value so just add values for each one.
When I select A then I can only select other values from A and when selecting B again values for B and so on...
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.