Get customfieldvalue with JS

Hello!

Im having abit of issue getting a customfield value for an issue with values that are in the background e.g when there is a transition screen, i want to pull an existing customfield value that was entered in at the create screen visible in the background

I currently can get the value if the field is within the same transition screen, but i cant do this when the field is not in the transition screen:

document.getElementById("customfield_10000").value;

Any guidance?

Many thanks, 

Pon

1 answer

0 vote
Alexey Matveev Community Champion Oct 28, 2017

Hello, 

First you have to get issue key using jira javascript API JIRA.Issue.getissuekey(). Then you can retrieve the value of the required field using Jira REST API /rest/api/2/issue/{issueIdOrKey}. Replace {issueIdOrKey} with the key retrieved by Jira.Issue.Getissuekey(). 

You can read more about retrieving issue key from javascript here

https://community.atlassian.com/t5/Answers-Developer-Questions/Read-current-issue-id-with-javascript/qaq-p/481560

You can read more about jira rest api here

https://docs.atlassian.com/jira/REST/server/#api/2/issue-getIssue

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,310 views 14 20
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot