Hello Everyone,
I want to hide fields based upon the following fields-
Kindly guide, or share sample to hide fields based upon screen type using Script-runner behaviour template.
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:-
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}
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 = falseif (field1Value == 'Some Value') { field2.hidden = true}
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
Hi @Jyoti Kumari ,
Instead of writing behaviour it’s better to add different create and edit screen.
Thanks,
Vikrant Yadav
Hello @Ram Kumar Aravindakshan _Adaptavist_
Thank you so much.It is working fine.
Hello @Vikrant Yadav
Thank you for the suggestion, but I needed this to be implemented by script runner.
Great to hear that the solution worked for you.
Please accept the answer.
It looks like you're new here. Sign in or register to get started.