Reputation: 11
Does anyone know how get a custom field option using a velocity template.
I am trying to set a default description based on issue type and custom field option can anyone help.
I have tried using Java script but no success
Upvotes: 1
Views: 1761
Reputation: 11
`<script language="javascript" type="text/javascript">
issueType = document.getElementById("issuetype-field");
requestType = document.getElementById("customfield_11504");
description = document.getElementById("description");
if (issueType)
{
target = document.getElementById == "2";
// Hide the Target Field if issueType isn't Service Request
if (requestType)
{
target = document.getElementById("customfield_11504");
// Hide Target Field if requestType isn't Deployment
if (issueType.value != "2") target.style.display = 'none';
issueType.onchange = function()
{
if (this.value == "2")
{
requestType.onchange = function()
{
if (this.value == "11501")
{
description.style.display = '';
description.value = 'Default Text for Deployment';
requestType.onchange = function()
{
if (this.value == "11900")
{
description.style.display = '';
description.value = 'Default Text for Enhancement';
requestType.onchange = function()
{
if (this.value == "11901")
{
description.style.display = '';
description.value = 'Default Text for New Account';
}
}
;
}
}
;
}
}
;
}
}
;
}`
Upvotes: 0
Reputation: 6329
Using the Jira REST API you can use the method http://example.com:8080/jira/rest/api/2/issue/createmeta?expand=projects.issuetypes.fields
(described here). This will give you the detailed information about available issue types, the custom fields and their specific options.
Upvotes: 1