Forums

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

How to add pop up screen when filed' dropdown value changes?

Amit Kumar Singh
Contributor
July 26, 2022

I have below custom field which have 3 option, when anyone select "Ready for Review", it should pop-up with few fields to fill before updating this filed.

 

image.png 

 

 

2 answers

1 accepted

0 votes
Answer accepted
Alex Koxaras -Relational-
Community Champion
July 26, 2022

Hi @Amit Kumar Singh 

Can you clarify the need behind this request? There could be a solution to your problem using behaviours instead of a popup as you request.

E.g.

  1. You can create the additional fields you wants.
  2. You place these fields on the corresponding screen
  3. You create a behaviour (if you have scriptrunner) with which you hide these additional fields until the user selects "Ready for review". When the users selects the value you want, you make these fields visible and required.

 

Hope that helps!

Alex

Amit Kumar Singh
Contributor
July 26, 2022

Hi @Alex Koxaras -Relational- 

Thanks for you quick response, i have added screes with workflow transition as when status changes there is screen pop-up with required fields.

But here i need a screen pop-up when anyone select "Ready for Review" from this field drop down single select list. so that if anyone select "Ready for Review" then few field should be verified/filled with details.

Alex Koxaras -Relational-
Community Champion
July 26, 2022

@Amit Kumar Singh you can't do exactly what you ask with out of the box Jira functionalities. My response stays the same, as above.

Do you have scriptrunner?

Amit Kumar Singh
Contributor
July 26, 2022

@Alex Koxaras -Relational- Yes, i have scriptrunner.

Alex Koxaras -Relational-
Community Champion
July 26, 2022

Then use it to create a behavior for your field.

Amit Kumar Singh
Contributor
July 26, 2022

@Alex Koxaras -Relational- but i have no idea as how to set up behavior and how it will work, could you please provide some more details as how to create this..?

Alex Koxaras -Relational-
Community Champion
July 28, 2022

@Amit Kumar Singh

  • go to Behaviour
  • Add new behaviour
  • on Fields -> add new field an choose the Single Select field (the one with "Ready for Review" value)
  • On that field Add Side Script
  • Enter the script below

def fieldOne = getFieldById("customfield_15751")
def fieldTwo = getFieldById("customfield_15752")
fieldOne.setHidden(true)
fieldTwo.setHidden(true)
fieldOne.setRequired(false)
fieldTwo.setRequired(false)


 
if (getFieldById(getFieldChanged()).getValue() == "Value 1") {
    fieldOne.setHidden(false)
    fieldOne.setRequired(true)
    fieldTwo.setHidden(false)
    fieldTwo.setRequired(true)
}

else{
    fieldOne.setHidden(true)
    fieldOne.setRequired(false)
    fieldOne.setFormValue(null)
    fieldTwo.setHidden(true)
    fieldTwo.setRequired(false)
    fieldTwo.setFormValue(null)
}
  • Replace the customfield_xxxxx values with these of your custom fields
  • Replace "Value 1" with "Ready for Review"
  • Add a mapping to your behavior (in which project and issue types this behavior will be active/run)
  • Test it!

Hope that helps!

Alex

Like Nick likes this
Amit Kumar Singh
Contributor
July 28, 2022
0 votes
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.
July 26, 2022

To do this, you would add the three fields to the same screen your drop-down field is on, and use a behaviour to show/hide them depending on the selection.

https://library.adaptavist.com/entity/control-form-field-based-on-selected-checkbox-value shows you how to do this with a checklist field rather than a drop-down, but the fields are very similar and I'm not sure you'd even need to change any of the code to cope with a select list instead of a check list.

Suggest an answer

Log in or Sign up to answer