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.
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
}
Below is a screenshot for your reference:-
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:-
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Great to hear that the solution worked for you. :)
Please accept the answer.
Thank you and Kind regards,
Ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Jyoti Kumari ,
Instead of writing behaviour it’s better to add different create and edit screen.
Thanks,
Vikrant Yadav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Vikrant Yadav
Thank you for the suggestion, but I needed this to be implemented by script runner.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.