Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to hide multiple fields based upon screen types(Edit and Create)

Jyoti Kumari March 19, 2023

Hello Everyone,

 

I want to hide fields based upon the following fields-

  • Edit Only
  • Edit and Create
  • Create Only

Kindly guide, or share sample to hide fields based upon screen type using Script-runner behaviour template.

2 answers

1 accepted

Suggest an answer

Log in or Sign up to answer
1 vote
Answer accepted
Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 20, 2023

Hi @Jyoti Kumari

In your description, you mentioned:-

I want to hide fields based upon the following fields-

  • Edit Only
  • Edit and Create
  • Create Only

When you say Edit Only, Edit and Create and Create only are you referring to the Create and Edit Screens?

If yes, then you can use the underlyingIssue condition to determine the visibility of the fields. The underlyingIssue is only accessible once the issue has been created.

So if you want to do it for only the create screen, you and use the Behaviour Initialiser and add this condition:-

def field = getFieldByName('Some Field')
field.hidden = false

/*
This is for the Create Screen only
*/

if (!underlyingIssue) {
field.hidden = true
}

Below is a screenshot for your reference:-

image1.png

If you want to add it for the edit screen only, you will need to use the Behaviour Initialiser with the sample code below:-

def field = getFieldByName('Some Field')
field.hidden = false

/*
This is for the Edit Screen only
*/

if (underlyingIssue) {
field.hidden = true
}

Below is a screenshot for your reference:-

image2.png

For both, you will need to use the Server-Side Behaviour and set it according to the values of a particular field.

def field1 = getFieldById(fieldChanged)
def field1Value = field1.value.toString()

def field2 = getFieldByName('Some Field')
field2.hidden = false

if (field1Value == 'Some Value') {
field2.hidden = true
}

Below is a screenshot for your reference:-

image3.png

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

I suggest you take a look at the Adaptavist Documentation to start.

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


Thank you and Kind regards,

Ram

Jyoti Kumari March 20, 2023

Hello @Ram Kumar Aravindakshan _Adaptavist_ 

 

Thank you so much.It is working fine.

Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 20, 2023

Hi @Jyoti Kumari 

Great to hear that the solution worked for you. :)

Please accept the answer.

Thank you and Kind regards,

Ram

0 votes
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.
March 19, 2023

Hi @Jyoti Kumari ,

Instead of writing behaviour it’s better to add different create and edit screen. 

 

Thanks,

Vikrant Yadav

Jyoti Kumari March 20, 2023

Hello @Vikrant Yadav 

 

Thank you for the suggestion, but I needed this to be implemented by script runner.

TAGS
AUG Leaders

Atlassian Community Events