Forums

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

Behaviour - Hide Message Field

Robert Bromley July 20, 2023

I cannot hide a message field like the way i do with another field. Is it not possible?

 

def issuetype = getIssueContext().getIssueType().name
def cfField1 = getFieldByName("Type of Service Component")
def cfMessage1 = getFieldByName("C4/C7 Existing Service Message")
def cfMessage2 = getFieldByName("C4/C7 Missing Service Message")


if (issuetype == "C7.R Retailer Initiated Supply Point Address Amendment")
{

cfField1.setHidden(true)
cfMessage1.setHidden(true)
cfMessage2.setHidden(true)
}
else
{
cfField1.setHidden(false)
cfMessage1.setHidden(false)
cfMessage2.setHidden(false)
}

2 answers

0 votes
Ram Kumar Aravindakshan _Adaptavist_
Community Champion
July 20, 2023

Hi @Robert Bromley

If you intend to use the Behaviour for the Issue Type, this must be done using the Behaviour Initialiser, not the Server-Side Behaviour.

Below is a screenshot of the Behaviour Initialiser configuration for your reference:-

behaviour_config.png

Below is the sample working code for your reference:-

def issueType = issueContext.issueType.name
def sampleList = getFieldByName('Sample List')

sampleList.hidden = false

if (issueType == 'Story') {
sampleList.hidden = true
}

Please note that the sample code above is not 100% exact to your environment. Hence, you will need to make the required modifications.

Below are a couple of test screenshots for your reference:-

1. When the Story issue type is selected as expected, the Sample List is hidden.

test1.png

2. When any other issue type is selected as expected, the Sample List is visible as shown in the screenshots below:-

test2.png

test3.png

test4.png

I hope this helps to solve your question. :-)

Thank you and Kind regards,

Ram

 

Robert Bromley July 21, 2023

Hi Ram,

Thanks for your reply. As per my code above ive already set this up as an "Initialiser". It hide certain drop down fields perfectly but it does not hide message fields.

Is it not possible to hide message fields?

Thanks

Rob

Ram Kumar Aravindakshan _Adaptavist_
Community Champion
July 21, 2023

Hi @Robert Bromley

It should be possible when the Create / Edit / Transition screen first appears.

But for more clarity, could you please share a screenshot of which field you are referring to so I can modify my example code accordingly?

Thank you and Kind regards,
Ram

Robert Bromley July 21, 2023

 

field.JPG

0 votes
Craig Nodwell
Community Champion
July 20, 2023

Hi @Robert Bromley welcome to the community.  Are you applying this to the field or as the initializer ?

Robert Bromley July 20, 2023

The field is on a screen. They wanted to have a message/header between fields

Craig Nodwell
Community Champion
July 20, 2023

:) I was referring to where in the Behaviour you are placing this.

Robert Bromley July 20, 2023

On the create screen

Robert Bromley July 21, 2023

Its set up as an Initialiser in the behaviour, so it take affect on the create screen

Suggest an answer

Log in or Sign up to answer