Hide "Configure Fields" Button only for certain issue types

Vidhya Mohan October 30, 2020

Hello,

 

Is there a way to hide configure fields only for certain issue types? 

 

Regards,

Vidhya

1 answer

1 accepted

0 votes
Answer accepted
Nir Haimov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 30, 2020

Hi @Vidhya Mohan 

Can you please share screenshot and elaborate more?

What you mean  by "configuration field"?

Vidhya Mohan October 30, 2020

@Nir Haimov , I'm talking about "Configure Fields" on the Create Issue page.  I want that to appear/disappear based on issue types selected

Nir Haimov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 30, 2020

Ohhh
I get it now.

No, you can't set such a thing, there is no such built-in option, but it is possible to write a JS to hide it when you want.

Vidhya Mohan October 30, 2020

I'm not well versed with coding. Is it possible to give me a JS which check the issue types and then disables the configure fields 

Nir Haimov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 30, 2020

Hi @Vidhya Mohan 

this will work for you

if ($("#issuetype-field").val() == "Task" || $("#issuetype-field").val() == "Bug")
$("#qf-field-picker-trigger").remove()

But if you are no coding, so you probably don't know where to put it either... 

Vidhya Mohan October 30, 2020

Thanks @Nir Haimov . Will this code work. I've figured out where to put this piece of code though :) 

 

<script type="text/javascript">
(function($) {
AJS.toInit(function(){
// init on load
if ($("#issuetype-field").val() == "Test" || $("#issuetype-field").val() == "Test Plan") || $("#issuetype-field").val() == "Test Set") || $("#issuetype-field").val() == "Test Execution") || $("#issuetype-field").val() == "Pre-Condition")
AJS.$("#qf-field-picker-trigger").hide();
})
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) {
// init on refresh
if ($("#issuetype-field").val() == "Test" || $("#issuetype-field").val() == "Test Plan") || $("#issuetype-field").val() == "Test Set") || $("#issuetype-field").val() == "Test Execution") || $("#issuetype-field").val() == "Pre-Condition")
AJS.$("#qf-field-picker-trigger").hide();
});
})(AJS.$);
</script>

Nir Haimov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 1, 2020

Hi @Vidhya Mohan 

I would suggest you to use this code instead :)

(function ($) {
AJS.toInit(function () {
// init on load
var issueTypes = ["Test", "Test Plan", "Test Set", "Test Execution", "Pre-Condition"];
if (issueTypes.includes($("#issuetype-field").val()))
AJS.$("#qf-field-picker-trigger").hide();
})
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) {
// init on refresh
if (issueTypes.includes($("#issuetype-field").val()))
AJS.$("#qf-field-picker-trigger").hide();
});
})(AJS.$);

 Try it out, if it works for you, please mark my solution as the answer

Vidhya Mohan November 2, 2020

Hello @Nir Haimov , the code is working only for 'Test' and is not working for any of the above mentioned issue types

Nir Haimov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 2, 2020

Hi @Vidhya Mohan 

I tested it and it works fine for all issue types.
Where did you put your script?

Vidhya Mohan November 2, 2020

Hello @Nir Haimov ,

I had put the script in field configuration of 'Test' issue type. - under 'Description' field

Regards,

Vidhya

Vidhya Mohan November 2, 2020

image.png

Nir Haimov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 2, 2020

Hi @Vidhya Mohan 

Does all your "test" issue types, are under the same field configuration?

Vidhya Mohan November 2, 2020

Hello @Nir Haimov ,

eeks. no. so I should put in all the different screen config? 

Nir Haimov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 2, 2020

Hi @Vidhya Mohan 

Exactly :)

Vidhya Mohan November 2, 2020

thank you @Nir Haimov 

Vidhya Mohan November 2, 2020

Hello @Nir Haimov ,

 

Create issue is not working now when I update in all the required FCs. Any suggestions?

The screen stays as below. 

 

Regards,

Vidhyaimage.png

Nir Haimov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 2, 2020

Hi @Vidhya Mohan 

Check for errors in the dev tools and let me know

Like Stuart Capel - London likes this
Vidhya Mohan November 2, 2020

Below are the issue types configured in my project.. I want "Configure Fields" to appear only for bug

 

image.png

Like Stuart Capel - London likes this
Nir Haimov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 2, 2020

I understand, but i need you to open the browser dev tool (click F12) and see if there are errors that cause your create screen to not show (as you sent before)

Like Stuart Capel - London likes this
Vidhya Mohan November 2, 2020

Hello @Nir Haimov 

Received error like this. and the page is still loading. 

 

Regards,

Vidhya

 

 

image.png

Like Stuart Capel - London likes this
Vidhya Mohan November 2, 2020
VM3731:10 Uncaught ReferenceError: issueTypes is not defined
at HTMLDocument.eval (eval at globalEval (batch.js?locale=en-UK:33), <anonymous>:10:9)
at HTMLDocument.dispatch (batch.js?locale=en-UK:44)
at HTMLDocument.v.handle (batch.js?locale=en-UK:44)
at Object.trigger (batch.js?locale=en-UK:44)
at Object.c.event.trigger (batch.js?locale=en-UK:64)
at HTMLDocument.<anonymous> (batch.js?locale=en-UK:44)
at Function.each (batch.js?locale=en-UK:33)
at c.fn.init.each (batch.js?locale=en-UK:29)
at c.fn.init.trigger (batch.js?locale=en-UK:44)
at Object.i.trigger (batch.js?locale=en-UK:572)
eval @ VM3731:10
dispatch @ batch.js?locale=en-UK:44
v.handle @ batch.js?locale=en-UK:44
trigger @ batch.js?locale=en-UK:44
c.event.trigger @ batch.js?locale=en-UK:64
(anonymous) @ batch.js?locale=en-UK:44
each @ batch.js?locale=en-UK:33
each @ batch.js?locale=en-UK:29
trigger @ batch.js?locale=en-UK:44
i.trigger @ batch.js?locale=en-UK:572
(anonymous) @ batch.js?locale=en-UK:790
dispatch @ batch.js?locale=en-UK:44
v.handle @ batch.js?locale=en-UK:44
trigger @ batch.js?locale=en-UK:44
c.event.trigger @ batch.js?locale=en-UK:64
(anonymous) @ batch.js?locale=en-UK:44
each @ batch.js?locale=en-UK:33
each @ batch.js?locale=en-UK:29
trigger @ batch.js?locale=en-UK:44
_setContent @ batch.js?locale=en-UK:2946
_setContent @ batch.js?locale=en-UK:3122
(anonymous) @ batch.js?locale=en-UK:603
(anonymous) @ batch.js?locale=en-UK:2946
(anonymous) @ batch.js?agile_global_admin_condition=true&jag=true&jaguser=true&jira.create.linked.issue=true&locale=en-UK&richediton=true&user-logged-in=true:6398
c @ batch.js?locale=en-UK:44
fireWith @ batch.js?locale=en-UK:44
(anonymous) @ batch.js?agile_global_admin_condition=true&jag=true&jaguser=true&jira.create.linked.issue=true&locale=en-UK&richediton=true&user-logged-in=true:6398
c @ batch.js?locale=en-UK:44
add @ batch.js?locale=en-UK:44
(anonymous) @ batch.js?agile_global_admin_condition=true&jag=true&jaguser=true&jira.create.linked.issue=true&locale=en-UK&richediton=true&user-logged-in=true:6398
c @ batch.js?locale=en-UK:44
fireWith @ batch.js?locale=en-UK:44
a.<computed> @ batch.js?locale=en-UK:44
(anonymous) @ batch.js?agile_global_admin_condition=true&jag=true&jaguser=true&jira.create.linked.issue=true&locale=en-UK&richediton=true&user-logged-in=true:6359
c @ batch.js?locale=en-UK:44
fireWith @ batch.js?locale=en-UK:44
complete @ batch.js?agile_global_admin_condition=true&jag=true&jaguser=true&jira.create.linked.issue=true&locale=en-UK&richediton=true&user-logged-in=true:6359
i @ batch.js?locale=en-UK:594
c @ batch.js?locale=en-UK:44
fireWith @ batch.js?locale=en-UK:44
u @ batch.js?locale=en-UK:44
(anonymous) @ batch.js?locale=en-UK:44
load (async)
send @ batch.js?locale=en-UK:44
ajax @ batch.js?locale=en-UK:44
m.makeRequest @ batch.js?locale=en-UK:594
refresh @ batch.js?agile_global_admin_condition=true&jag=true&jaguser=true&jira.create.linked.issue=true&locale=en-UK&richediton=true&user-logged-in=true:6359
getUseConfigurableForm @ batch.js?agile_global_admin_condition=true&jag=true&jaguser=true&jira.create.linked.issue=true&locale=en-UK&richediton=true&user-logged-in=true:6359
render @ batch.js?agile_global_admin_condition=true&jag=true&jaguser=true&jira.create.linked.issue=true&locale=en-UK&richediton=true&user-logged-in=true:6398
content @ batch.js?agile_global_admin_condition=true&jag=true&jaguser=true&jira.create.linked.issue=true&locale=en-UK&richediton=true&user-logged-in=true:6398
builder @ batch.js?locale=en-UK:2946
_setContent @ batch.js?locale=en-UK:2946
_setContent @ batch.js?locale=en-UK:3122
(anonymous) @ batch.js?locale=en-UK:603
c @ batch.js?locale=en-UK:44
fireWith @ batch.js?locale=en-UK:44
a.<computed> @ batch.js?locale=en-UK:44
c @ batch.js?locale=en-UK:44
fireWith @ batch.js?locale=en-UK:44
l @ batch.js?locale=en-UK:106
c @ batch.js?locale=en-UK:44
fireWith @ batch.js?locale=en-UK:44
a.<computed> @ batch.js?locale=en-UK:44
c @ batch.js?locale=en-UK:44
fireWith @ batch.js?locale=en-UK:44
a.<computed> @ batch.js?locale=en-UK:44
c @ batch.js?locale=en-UK:44
fireWith @ batch.js?locale=en-UK:44
(anonymous) @ batch.js?locale=en-UK:106
(anonymous) @ batch.js?locale=en-UK:82
Y @ batch.js?locale=en-UK:82
Z @ batch.js?locale=en-UK:82
F.resolve @ batch.js?locale=en-UK:82
Y @ batch.js?locale=en-UK:82
(anonymous) @ batch.js?locale=en-UK:82
(anonymous) @ batch.js?locale=en-UK:82
(anonymous) @ batch.js?locale=en-UK:82
Y @ batch.js?locale=en-UK:82
Z @ batch.js?locale=en-UK:82
F.resolve @ batch.js?locale=en-UK:82
Y @ batch.js?locale=en-UK:82
Z @ batch.js?locale=en-UK:82
F.resolve @ batch.js?locale=en-UK:82
al @ batch.js?locale=en-UK:82
(anonymous) @ batch.js?locale=en-UK:88
Y @ batch.js?locale=en-UK:82
Z @ batch.js?locale=en-UK:82
F.resolve @ batch.js?locale=en-UK:82
(anonymous) @ batch.js?locale=en-UK:88
n @ batch.js?locale=en-UK:88
aa @ batch.js?locale=en-UK:82
load (async)
loadScript @ batch.js?locale=en-UK:82
e @ batch.js?locale=en-UK:88
d @ batch.js?locale=en-UK:88
load @ batch.js?locale=en-UK:88
(anonymous) @ batch.js?locale=en-UK:82
H @ batch.js?locale=en-UK:82
fetchDep @ batch.js?locale=en-UK:82
Z @ batch.js?locale=en-UK:82
getDeps @ batch.js?locale=en-UK:82
(anonymous) @ batch.js?locale=en-UK:82
H @ batch.js?locale=en-UK:82
w @ batch.js?locale=en-UK:82
K @ batch.js?locale=en-UK:82
_processResourceResponse @ batch.js?locale=en-UK:106
(anonymous) @ batch.js?locale=en-UK:106
c @ batch.js?locale=en-UK:44
fireWith @ batch.js?locale=en-UK:44
u @ batch.js?locale=en-UK:44
(anonymous) @ batch.js?locale=en-UK:44
load (async)
send @ batch.js?locale=en-UK:44
ajax @ batch.js?locale=en-UK:44
_getScriptsForResources @ batch.js?locale=en-UK:106
(anonymous) @ batch.js?locale=en-UK:106
_enqueueRequest @ batch.js?locale=en-UK:106
_resolveAsync @ batch.js?locale=en-UK:106
n @ batch.js?locale=en-UK:106
require @ batch.js?locale=en-UK:106
WRM.require @ batch.js?locale=en-UK:109
downloadResources @ batch.js?locale=en-UK:2946
show @ batch.js?locale=en-UK:2946
c @ batch.js?agile_global_admin_condition=true&jag=true&jaguser=true&jira.create.linked.issue=true&locale=en-UK&richediton=true&user-logged-in=true:6428
d @ batch.js?agile_global_admin_condition=true&jag=true&jaguser=true&jira.create.linked.issue=true&locale=en-UK&richediton=true&user-logged-in=true:6425
c @ batch.js?locale=en-UK:44
fireWith @ batch.js?locale=en-UK:44
a.<computed> @ batch.js?locale=en-UK:44
c @ batch.js?locale=en-UK:44
fireWith @ batch.js?locale=en-UK:44
l @ batch.js?locale=en-UK:106
c @ batch.js?locale=en-UK:44
fireWith @ batch.js?locale=en-UK:44
a.<computed> @ batch.js?locale=en-UK:44
c @ batch.js?locale=en-UK:44
fireWith @ batch.js?locale=en-UK:44
a.<computed> @ batch.js?locale=en-UK:44
c @ batch.js?locale=en-UK:44
add @ batch.js?locale=en-UK:44
(anonymous) @ batch.js?locale=en-UK:106
c @ batch.js?locale=en-UK:44
fireWith @ batch.js?locale=en-UK:44
u @ batch.js?locale=en-UK:44
(anonymous) @ batch.js?locale=en-UK:44
load (async)
send @ batch.js?locale=en-UK:44
ajax @ batch.js?locale=en-UK:44
_getScriptsForResources @ batch.js?locale=en-UK:106
(anonymous) @ batch.js?locale=en-UK:106
_enqueueRequest @ batch.js?locale=en-UK:106
_resolveAsync @ batch.js?locale=en-UK:106
n @ batch.js?locale=en-UK:106
require @ batch.js?locale=en-UK:106
WRM.require @ batch.js?locale=en-UK:109
(anonymous) @ batch.js?agile_global_admin_condition=true&jag=true&jaguser=true&jira.create.linked.issue=true&locale=en-UK&richediton=true&user-logged-in=true:6425
c._clickHandler @ batch.js?locale=en-UK:808
dispatch @ batch.js?locale=en-UK:44
v.handle @ batch.js?locale=en-UK:44
Show 92 more frames
Like Stuart Capel - London likes this
Nir Haimov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 2, 2020

@Vidhya Mohan  try to put this line:

var issueTypes = ["Test", "Test Plan", "Test Set", "Test Execution", "Pre-Condition"];

Also inside "Jira.bind" before the "if" statement

Like Stuart Capel - London likes this
Vidhya Mohan November 2, 2020

Hello @Nir Haimov 

Like this?

 

<script type="text/javascript">
(function ($) {
AJS.toInit(function () {
// init on load
var issueTypes = ["Test", "Test Plan", "Test Set", "Test Execution", "Pre-Condition"];
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context){
if (issueTypes.includes($("#issuetype-field").val()))
AJS.$("#qf-field-picker-trigger").hide();
});
})
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) {
// init on refresh
if (issueTypes.includes($("#issuetype-field").val()))
AJS.$("#qf-field-picker-trigger").hide();
});
})(AJS.$);
</script>
Like Stuart Capel - London likes this
Nir Haimov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 2, 2020

Hi @Vidhya Mohan 

Like this:

(function ($) {
AJS.toInit(function () {
// init on load
var issueTypes = ["Test", "Test Plan", "Test Set", "Test Execution", "Pre-Condition"];
if (issueTypes.includes($("#issuetype-field").val()))
AJS.$("#qf-field-picker-trigger").hide();
})
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) {
// init on refresh
var issueTypes = ["Test", "Test Plan", "Test Set", "Test Execution", "Pre-Condition"];
if (issueTypes.includes($("#issuetype-field").val()))
AJS.$("#qf-field-picker-trigger").hide();
});
})(AJS.$);
Like # people like this
Vidhya Mohan November 2, 2020

Thank you @Nir Haimov . It worked :) 

Like Stuart Capel - London likes this
Vidhya Mohan January 28, 2021

@Nir Haimov

This javascript is suddenly not working. It is getting displayed on the screen (screenshot below)

Any idea why this is happening suddenly?  Version of JIRA - v 8.13.2

image.png

Nir Haimov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 29, 2021

Hi @Vidhya Mohan 

Please check Jira admin settings if maybe HTML support in custom field description turned off.

Like Vidhya Mohan likes this
Vidhya Mohan January 31, 2021

Thanks @Nir Haimov 

Vijay Kumar May 26, 2021

But it is hiding for all users, is there way we can hide only for users not for admins ?

Suggest an answer

Log in or Sign up to answer