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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Create Epic Link Programatically

After some research, found that we can create the Epic Link custom field using below code.

MutableIssue epicIssue = ComponentAccessor.getIssueManager().getIssueObject("Epic_Key");
jiraIssue.setCustomFieldValue(customFieldObject, epicIssue);

The program runs good. However it doesn't show up my Epic Link on Issue Screen. 

When I ask "Where is my field" it says, the Epic Link value is not set, therefore it is not visible. 

Any idea on this? How can I make my Epic Link visible when I create the Epic Link programatically?

Thanks in advance!

1 answer

0 votes

Your code isn't setting the value.

Your code snippet isn't complete enough to show us where it might be wrong, and you have not said where it is running.

Hi Nic, 

Sorry, about that. Here is my code. Please check if you can help on this.

String custFieldValue = "PT-01" //This is my Epic Key
CustomFieldManager cfManager = ComponentAccessor.getCustomFieldManager();
CustomField jiraCustomField = cfMgr.getCustomFieldObjectByName(Constants.EPIC_LINK);
MutableIssue epicIssueObject = ComponentAccessor.getIssueManager().getIssueObject(custFieldValue);

if(epicIssueObject != null) {
newJIRAIssue.setCustomFieldValue(jiraCF, epicIssue);
} else {
log.info("Epic Link " + custFieldValue + " is not available.");
}
newJiraIssue.setCustomFieldValue(jiraCustomField, custFieldValue);

 

I didn't find any other way to set the values. I think you mentioned about "custFieldValue". That was actually a string that contains my Epic Key.

Where it is running -> I am using Jira Software (Server), not cloud

Any idea on this?

Can anyone help on this please?

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you