Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

User Macro : access to script variable outside of script

GrBr I'm New Here Dec 07, 2020

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.

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence

Announcing Team Calendars in Confluence Data Center

Hi Community! We're thrilled to share that Team Calendars for Confluence is now a built-in feature for Confluence Data Center releases 7.11 and beyond.  A long time favorite,  Team Cale...

78 views 0 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you