Behaviour issue - Message Custom Field not hiding

Andrew Henders October 7, 2020

Hi,

I'm having issues hiding Custom field type "Message Custom Field (for Edit)" using Behaviours.

The following Behaviour server-side script does not hide the Message Custom Field (customfield_13517) on the Create screen:

def singleIssuePicker = getFieldById("customfield_13515")
def messageCustomField = getFieldById("customfield_13517")
def partnerAgreementCf = getFieldById("customfield_13514")
def optionValue = partnerAgreementCf.getValue().toString()

singleIssuePicker.setHidden(true)
messageCustomField.setHidden(true)

if (optionValue == 'Yes') {
singleIssuePicker.setHidden(false)
}
else if (optionValue == 'No') {
messageCustomField.setHidden(false)
}

 

I've tested a few other custom field types which hide OK. Is there a difference with the Message Custom Field field type that does not allow it to be hidden like other fields? Is it possible to hide this field type using another method?

JIRA Server 8.3.4

Scriptrunner 5.6.2.1-jira8

 

Thanks,

Andrew

2 answers

1 accepted

0 votes
Answer accepted
Vikrant Yadav
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 7, 2020

Hi @Andrew Henders this issue fix is mentioned in this link :- https://bitbucket.org/jibrok/message-field/issues/3

 

Thanks

Vikrant Yadav
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 7, 2020
  • Set the behaviour switch to “hide” and set “setHidden(false) in the server side script do the job
Andrew Henders October 7, 2020

Thanks for the reply Vikrant.

I tried the suggested fix "Set the behaviour switch to “hide” and set setHidden(false) in the server-side script do the job" but the field is still showing.

Note that I'm not using this addon "Message field by JiBrok". I believe I'm using the inbuilt Atlassian field "Message Custom Field (for edit)"

Screen Shot 2020-10-08 at 3.32.45 pm.pngScreen Shot 2020-10-08 at 3.28.28 pm.png

JiBrok
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
October 7, 2020

I'm not using this addon "Message field by JiBrok" 

:'(

Like Andrew Henders likes this
JiBrok
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
October 7, 2020

You are using a field from the Toolkit Plugin for Jira. As far as I know, this field can't be hidden using SR because it doesn't contain any IDs when displayed.

JiBrok
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
October 7, 2020

I don't recommend doing this, but technically it will work.

image 2020-10-08 at 09.16.03.png

Add two such div tags above your message:

<div class="field-group">
<div id="customfield_sr_please_hide">
MESSAGE TEXT
</div>
</div>

and in SR behaviour:

def field = getFieldById("customfield_sr_please_hide")
field.setHidden(true)  
Like # people like this
Andrew Henders October 7, 2020

Thanks for the update Vikrant. On a positive note, I've just installed and tested the Message Field by JiBrok on our test instance and it works. I'll perform a few more tests. Cheers again for the assistance.

Andrew Henders October 7, 2020

Sorry, thanks JiBrok too!

Like JiBrok likes this
Vikrant Yadav
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 7, 2020

Hi @JiBrok Thanks for the solution, new solution for me. :)

We are using Message Field add-on.  this solution will help us. 

why you are not recommending to do this, is there any wrong impact on JIRA instance or effects other fields as well ?

JiBrok
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
October 7, 2020

@Vikrant Yadav 

I don't think this will cause any problems with the service or the screen.

I don't recommend doing this, because it's not "obvious behavior", but a life hack :)

Now you remember about this decision but what about your colleagues? This solution works here and now. If something changes in the next version of Jira or SR, it may break.

Like Vikrant Yadav likes this
Vikrant Yadav
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 8, 2020

okay, thank you @JiBrok 

Like JiBrok likes this
Siddheshwar Mhetre December 6, 2021

Hi,

 I have added ID but still its not hiding for me

Below are the default value

<div class="aui-message new">
<div id="customfield_sr_please_hide">
<p class="title">
<span class="aui-icon icon-warning"></span>
<strong>International ticket escalation</strong>
</p>
<p> Escalation will go to GICS project as product category contains "IAS" </p>
</div>
</div>

Thanks,

Sid

0 votes
Andy Hurley April 28, 2023

I have a similar problem using Message++ fields that just don't seem to hide from behaviours. I have tried the above code and it does not work in this case. The text gets hidden but not the alert box around it and it doesn't unhide when it should.

All I want is to present a pop up alert in an issue screen when certain options are chosen in the same way they I have other fields appear but there seems to be no way to do this.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.3.4
TAGS
AUG Leaders

Atlassian Community Events