Hello,
I am currently trying to create a big user macro, and one of the things I am trying to do is get a version of our tests via an ajax call and use that variable to feed it as a parameter to another macro outside of the script. It's hard to be super clear so here is the example :
<script type="text/javascript">
var component= $("#componentHidden").text()
var myversion=$("#versionHidden").text()
var myurl="fully_working_jql"
AJS.${D}.ajax({
xhrFields: {
withCredentials: true
},
url: myurl,
async: false,
cache: false,
success: function(response,st,xhr) {
console.log(response);
var the_parameter_I_get_back = response.issues[0].key ;
document.write(the_parameter_I_get_back);
},
error: function(xhr, status, error) {
var err = xhr.responseText;
alert(JSON.stringify(err));
},
});
</script>
<ac:structured-macro ac:name="jirachart" ac:schema-version="1" ac:macro-id="working_macro_id">
<ac:parameter ac:name="border">false</ac:parameter>
<ac:parameter ac:name="showinfor">true</ac:parameter>
<ac:parameter ac:name="server">Test</ac:parameter>
<ac:parameter ac:name="jql">issue in testExecutionTests('here_is_where_I_want_to_use_the_parameter')</ac:parameter>
<ac:parameter ac:name="statType">issuetype</ac:parameter>
<ac:parameter ac:name="chartType">pie</ac:parameter>
<ac:parameter ac:name="width" />
<ac:parameter ac:name="isAuthenticated">true</ac:parameter>
<ac:parameter ac:name="serverId">working_server_id</ac:parameter>
</ac:structured-macro>
Is this even possible ?
I thought about using the title if it isn't to store the data, but I couldn't find the way to change the title in the script.
Thanks for your help.