Wiki source code of Making a JIRA Button to show a search
Version 1.1 by Normann P. Nielsen on 2026/11/15 15:44
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | Using the combined facilities of [[Making a ADG like button>>Main.atlassian.atlassian-jira.making-a-adg-like-button]] and [[Getting a field value in Read Mode>>Main.atlassian.atlassian-jira.getting-a-field-value-in-read-mode]] - we can make a button to display a JQL search in a window. | ||
| 2 | |||
| 3 | Sample code for the Button (made as a "Message Custom Field (for view)" from the [[JIRA Toolkit>>https://marketplace.atlassian.com/plugins/com.atlassian.jira.toolkit]]) could be (or use the [[ADG>>https://design.atlassian.com/latest/]] to make a button - see in the [[Sandbox>>https://docs.atlassian.com/aui/latest/sandbox/index.html]]): | ||
| 4 | |||
| 5 | |||
| 6 | {{code}} | ||
| 7 | <a id=list0 href="" target="_blank" class="aui-button aui-button-primary" style="background-image: linear-gradient(rgb(200, 200, 200) 0%, rgb(100,100,100) 100%); border-color: white;"> | ||
| 8 | Complete list for the Machine</a> | ||
| 9 | |||
| 10 | <script language=javascript> | ||
| 11 | var machinenumber=(AJS.$("#customfield_10400-val").text().trim()); | ||
| 12 | if (machinenumber != '') | ||
| 13 | { | ||
| 14 | var jql0='"Machine Number" ~ "' + machinenumber + '" ORDER BY CREATED DESC'; | ||
| 15 | var httpurl0='https://jira.mydomain.com/issues/?jql=' + jql0; | ||
| 16 | AJS.$("#list0").attr('href', httpurl0); | ||
| 17 | } | ||
| 18 | else | ||
| 19 | { | ||
| 20 | AJS.$("#list0").hide(); | ||
| 21 | } | ||
| 22 | </script> | ||
| 23 | {{/code}} | ||
| 24 | |||
| 25 | Gives: | ||
| 26 | |||
| 27 | [[image:Screen Shot 2014-09-12 at 13.06.58.png||width="490"||height="101"||alt="Screen Shot 2014-09-12 at 13.06.58.png"]] | ||
| 28 | |||
| 29 | |||
| 30 | |||
| 31 | The Style | ||
| 32 | |||
| 33 | |||
| 34 | {{code}} | ||
| 35 | style="background-image: linear-gradient(rgb(200, 200, 200) 0%, rgb(100,100,100) 100%); border-color: white;" | ||
| 36 | {{/code}} | ||
| 37 | |||
| 38 | Gives the alternate color (grey), otherwise the button will be blue... |