Forums

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

Hide "Epic Link" column when editing issue, but allow to set "Epic Link" when creating issue?

zaharovvv_suek_ru
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 3, 2018

Hey, guys!

Is it possible to hide or prevent editing "Epic Link" column when editing issue, but allow to set "Epic Link" when creating issue? This rule should be applied just for issues which have "Epic Link". 

I have a chance to use ScriptRunner.Hide Epic Link.png

3 answers

1 accepted

2 votes
Answer accepted
Mark Markov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 3, 2018

Hello @zaharovvv_suek_ru

You can use ScriptRunner Behaviours for this

Add-ons -> Behaviours - Add

Add mapping to your project and issue types

Fields -> Add -> Epic Link 

Add server-side script on that field

if (getActionName() != "Create") {
getFieldById(getFieldChanged()).setHidden(true)
}
Mark Markov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 3, 2018

It will be looks like this

image.png

zaharovvv_suek_ru
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 3, 2018

@Mark Markov Thank you very much for your reply!

I've forgot to say that this should applied just for issues which have "Epic Link". 

I've tried to use the following code: 

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue

def customFieldManager = ComponentAccessor.getCustomFieldManager();
def epicLink = customFieldManager.getCustomFieldObjectByName('Epic Link');
def epic = issue.getCustomFieldValue(epicLink);

if (getActionName() != "Create" && epic) {
getFieldById(getFieldChanged()).setHidden(true)
}

 However, I see the error: The variable [issue] is undeclared.

How can I check whether there is an 'Epic Link' ?

Thanks in advance.

Mark Markov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 3, 2018

Because behaviours doesnt have issue variable.

Try to use 

def epic = underlyingIssue.getCustomFieldValue(epicLink);

 instead

zaharovvv_suek_ru
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 3, 2018

@Mark Markov

Thank you very, very, very much! It worls like a charm!

The full code looks like this:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue

def customFieldManager = ComponentAccessor.getCustomFieldManager();
def epicLink = customFieldManager.getCustomFieldObjectByName('Epic Link');
def epic = underlyingIssue.getCustomFieldValue(epicLink);

if (getActionName() != "Create" && epic) {
getFieldById(getFieldChanged()).setHidden(true)
}
Mark Markov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 3, 2018

You re welcome :)

1 vote
Tarun Sapra
Community Champion
July 3, 2018

Hello @zaharovvv_suek_ru

You have to customize the screen scheme definition. Basically make sure that "Epic link" field is available on create and view screen and not present on edit screen.

Please read the docs here as to how you can create screen scheme and map it with issueType

https://confluence.atlassian.com/adminjiraserver/associating-a-screen-with-an-issue-operation-938847289.html

zaharovvv_suek_ru
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 3, 2018

@Tarun Sapra 

Thanks for your reply! I'm sorry I've forgot to say that this should applied just for issues which have "Epic Link".  Thanks in advance.

Tarun Sapra
Community Champion
July 3, 2018

Ok, then please go with the answer provided by @Mark Markov

1 vote
Grigory Salnikov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 3, 2018

Hi!

Yes, it is possible. You should edit the Screen Scheme associated with the project to make 2 different screens for edit and view.

Grigory Salnikov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 3, 2018

This article should help to understand this operation.

zaharovvv_suek_ru
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 3, 2018

@Grigory Salnikov

Thanks for your reply! I'm sorry I've forgot to say that this should applied just for issues which have "Epic Link".  Thanks in advance.

Grigory Salnikov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 3, 2018

Ok. I see. You're welcome!

Suggest an answer

Log in or Sign up to answer