Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
  • Community
  • Q&A
  • Jira
  • Questions
  • How to pop up alert box which contains new custom field based on the value of another field in Jira

How to pop up alert box which contains new custom field based on the value of another field in Jira

Sushmitha
Contributor
March 27, 2023

Hi ,

I need some help with setting a field.

I have 2 'Multi Select List' custom fields say Field1 and Field2.

I want to pop up new field only when  'Field1= option a' and 'Field2= option p'

Currently I am able to get new field ( of type radio button) on create issue screen right below the 'Field1' and 'Field2' when the condition is met.

But I want to know if new field can be displayed as pop up ( for example alert window) instead of displaying field on create issue screen ?

If yes, Please let me know how we can achieve this ?

Thanks

Sushmitha 

1 answer

0 votes
Oday Rafeh
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.
March 27, 2023

Hi @Sushmitha ,

From my information, Jira didn't support this functionality.  

One possible workaround could be to create a custom web panel that will be displayed as a popup when the conditions are met. You can write a small JavaScript code to display a pop-up with the desired custom field when the user selects the specified options in Field1 and Field2.

Another approach could be to use a third-party app or plugin that provides popup alerts or notifications based on Jira custom fields. You can search for Jira apps in the Atlassian Marketplace.

I hope this helps! Let me know if you have any further questions.

Regards, 

Oday

Sushmitha
Contributor
March 27, 2023

Hi @Oday Rafeh ,

Thanks for your response. 

Do you have any sample scripts that I can use for writing JavaScript code to display a pop-up with the desired custom field when the user selects the specified options in Field1 and Field2 ?

Like Oday Rafeh likes this
Oday Rafeh
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.
March 28, 2023

Hi @Sushmitha 

Try this please: 

AJS.toInit(function() {
var field1 = AJS.$("#customfield_10000"); // replace 10000 with the ID of Field1
var field2 = AJS.$("#customfield_10001"); // replace 10001 with the ID of Field2
var popup = AJS.$("<div class='aui-popup'></div>");
var customField = AJS.$("<input type='text' name='customfield_10002' id='customfield_10002'/>"); // replace 10002 with the ID of the custom field you want to display in the pop-up

// function to check if the specified options are selected
function checkFields() {
if (field1.val() == "option a" && field2.val() == "option p") { // replace "option a" and "option p" with the values of the options you want to check
customField.appendTo(popup);
popup.show();
} else {
popup.hide();
}
}

// bind the checkFields function to the change event of Field1 and Field2
field1.change(checkFields);
field2.change(checkFields);
});

Suggest an answer

Log in or Sign up to answer