Get customfieldvalue with JS

Deleted user October 27, 2017

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 votes
Alexey Matveev
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.
October 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 Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events