Using the combined facilities of Making a ADG like button and Getting a field value in Read Mode - we can make a button to display a JQL search in a window.
Sample code for the Button (made as a "Message Custom Field (for view)" from the JIRA Toolkit) could be (or use the ADG to make a button - see in the Sandbox):
<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;"> Complete list for the Machine</a> <script language=javascript> var machinenumber=(AJS.$("#customfield_10400-val").text().trim()); if (machinenumber != '') { var jql0='"Machine Number" ~ "' + machinenumber + '" ORDER BY CREATED DESC'; var httpurl0='https://jira.mydomain.com/issues/?jql=' + jql0; AJS.$("#list0").attr('href', httpurl0); } else { AJS.$("#list0").hide(); } </script>
Gives:
The Style
style="background-image: linear-gradient(rgb(200, 200, 200) 0%, rgb(100,100,100) 100%); border-color: white;"
Gives the alternate color (grey), otherwise the button will be blue...