How params works in Atlassian connect staticContentMacros

Alberto Barón March 14, 2024

Hi all, 

I would like to ask a doubt related to Atlassian connect for confluence. I am new and I would like to understand how it works. 

 

I have a static content macro. When user calls the macro, it will appear a edition mode view with a select and some options. 

 

My atlassian-connect.json file is:
```

"modules": {
"staticContentMacros": [
{
"name": {
"value": "Static Macro (no editor)"
},
"description": {
"value": "Choose a sport"
},
"url": "/macro?sport={sport}",
"key": "static-sport-macro",
"categories": ["development"],
"parameters": [
{
"identifier": "sport",
"name": {
"value": "Favourite Sport"
},
"type": "enum",
"values": [
"nfl", "baseball", "basketball", "football", "golf", "tennis"
]
}
]
}
]
}

```

 

With that I have realized that I can see a enum select with those values in the editor macro. When it changes, it is said: 'changes autosaved..' but main view select value does not change and it should change.

 

For that reason, when I try to get the variable value in the JS file , comes blank.
The macro endpoints would render the view in this way:

var requestSport = req.param('sport');
res.render('macro/macro-view', {
sport: sport
});

 

It could be a problem related to Express versions... the way that I am getting the value from params... or is there anything that could help me to get the value selected in the enum selector?

 

Dependencies comes on this version:

"dependencies": {
"atlassian-connect-express": "^7.7.0",
"body-parser": "^1.14.2",
"compression": "^1.6.0",
"cookie-parser": "^1.4.0",
"errorhandler": "^1.4.2",
"express": "^4.18.1",
"express-hbs": "*",
"jugglingdb-sqlite3": "0.0.5",
"morgan": "^1.10.0",
"sequelize": "^6.21.4",
"static-expiry": ">=0.0.5"
},
"devDependencies": {
"ngrok": "^5.0.0-beta.2"
}

 

Thanks!!

 

1 answer

1 accepted

0 votes
Answer accepted
Alberto Barón March 18, 2024

Problem was the dependencies version. 

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
AUG Leaders

Atlassian Community Events