Is it possible to edit roadmap planner macro with script or similar
Asked by Ari J Lahti:

Was trying to find out but google failed.

Is it possible to edit roadmap planner macro programmatically (with script runner or similar)

What I need to do is to create calendar for sprints in scrum. I would know how many sprints I have and how long they would take, but I'd hate to create manually 26 instances on roadmap (every year)


Answers:
author: David Berclaz
body: Hi [@Ari J Lahti](/t5/user/viewprofilepage/user-id/2576471),

There a some Jira apps that can show your sprints on a Timeline. Some of them are also providing gadgets that can be displayed in Confluence.

Cheers,

David


author: Dominic Lagger
body: Hi [@Ari J Lahti](/t5/user/viewprofilepage/user-id/2576471)

I would have a possible solution. It is not very easy and you need developer skills. I try to explain what my thought are.

When you save a Roadmap Planner page, the page could look like this:

![Roadmap.png](https://community.atlassian.com/t5/image/serverpage/image-id/56913i7AE39E2C4BDC436B/image-dimensions/221x140?v=v2 "Roadmap.png")

Now, you can check the [Storage Format](https://confluence.atlassian.com/doc/confluence-storage-format-790796544.html). The plugin would look like this:

```
<p>
<ac:structured-macro ac:name="roadmap" ac:schema-version="1" ac:macro-id="8ac912c4-e922-4b48-8e09-afb5a4602735">
<ac:parameter ac:name="maplinks" />
<ac:parameter ac:name="timeline">true</ac:parameter>
<ac:parameter ac:name="pagelinks" />
<ac:parameter ac:name="source">%7B%22title%22%3A%22Roadmap%20Planner%22%2C%22timeline%22%3A%7B%22startDate%22%3A%222019-06-07%2000%3A00%3A00%22%2C%22endDate%22%3A%222019-08-01%2000%3A00%3A00%22%2C%22displayOption%22%3A%22MONTH%22%7D%2C%22lanes%22%3A%5B%7B%22title%22%3A%22Team%201%20Lane%22%2C%22color%22%3A%7B%22lane%22%3A%22%23f6c342%22%2C%22bar%22%3A%22%23fadb8e%22%2C%22text%22%3A%22%23594300%22%2C%22count%22%3A1%7D%2C%22bars%22%3A%5B%7B%22title%22%3A%22Sprint%201%22%2C%22description%22%3A%22This%20is%20the%20first%20bar.%22%2C%22startDate%22%3A%222019-06-01%2000%3A00%3A00%22%2C%22duration%22%3A2%2C%22rowIndex%22%3A0%2C%22id%22%3A%22633c8e7c-3c2a-4341-a143-c5cded5b36c8%22%2C%22pageLink%22%3A%7B%7D%7D%2C%7B%22title%22%3A%22Sprint%202%22%2C%22description%22%3A%22This%20is%20the%20second%20bar.%22%2C%22startDate%22%3A%222019-08-01%2007%3A21%3A58%22%2C%22duration%22%3A1%2C%22rowIndex%22%3A1%2C%22id%22%3A%22e7734b5c-0639-44f9-9ef5-8c8c7f72bc21%22%2C%22pageLink%22%3A%7B%7D%7D%5D%7D%5D%2C%22markers%22%3A%5B%7B%22title%22%3A%22Today%22%2C%22markerDate%22%3A%222019-06-23%2006%3A39%3A12%22%7D%5D%7D</ac:parameter>
<ac:parameter ac:name="title">Roadmap%20Planner</ac:parameter>
<ac:parameter ac:name="hash">feb9ee5ea17f0034ce8ca464fa1fdedb</ac:parameter>
</ac:structured-macro>
</p>?
```

<br />

The important line for us is the **source** section. The source section is an encoded JSON. If you decode the source section, it looks like this:

```
{??
???"title":"Roadmap?Planner",
???"timeline":{??
??????"startDate":"2019-06-07?00:00:00",
??????"endDate":"2019-08-01?00:00:00",
??????"displayOption":"MONTH"
???},
???"lanes":[??
??????{??
?????????"title":"Team?1?Lane",
?????????"color":{??
????????????"lane":"#f6c342",
????????????"bar":"#fadb8e",
????????????"text":"#594300",
????????????"count":1
?????????},
?????????"bars":[??
????????????{??
???????????????"title":"Sprint?1",
???????????????"description":"This?is?the?first?bar.",
???????????????"startDate":"2019-06-01?00:00:00",
???????????????"duration":2,
???????????????"rowIndex":0,
???????????????"id":"633c8e7c-3c2a-4341-a143-c5cded5b36c8",
???????????????"pageLink":{??

???????????????}
????????????},
????????????{??
???????????????"title":"Sprint?2",
???????????????"description":"This?is?the?second?bar.",
???????????????"startDate":"2019-08-01?07:21:58",
???????????????"duration":1,
???????????????"rowIndex":1,
???????????????"id":"e7734b5c-0639-44f9-9ef5-8c8c7f72bc21",
???????????????"pageLink":{??

???????????????}
????????????}
?????????]
??????}
???],
???"markers":[??
??????{??
?????????"title":"Today",
?????????"markerDate":"2019-06-23?06:39:12"
??????}
???]
}
?And now you know, how the Roadmap Planner looks in a JSON format.?
```

Now you could make an [user macro](https://confluence.atlassian.com/doc/writing-user-macros-4485.html) with some javascript. Make a JSON programmatically and encoding/decoding the json and just wrap the raodmap planner macro in yours.

Hope this wasn't to much complicated. I would love to here from you, if you tried it and especially if it worked.

Regards

Dominic

comments: author: Ari J Lahti
body: Well, I am not totally unfamiliar with JS development, and I understand what you are aiming for and yes, it might work. Truth to be told, this does look something which is... well not exactly complicated but painfully arduous.

Will not push the accept answer button before trying it out :)


author: Dominic Lagger
body: This is true, it will be painfully arduous...

Another solution does not cross my mind at the moment.


author: nnako
body: What about the \`hash\` value in the example? What type of hash does this have to be ("sha1"? or other) and to which data does it refer (the encoded or decoded JSON of the user data or maybe something else?) in order to be accepted by the Confluence platform after changing the roadmap planner macro's user data content?


author: Nikola Gaydarov
body: Hi [@Dominic Lagger](/t5/user/viewprofilepage/user-id/601600) , I am not able to translate the source the way you did. Can you please help me out. What kind of decoder did you use?

Cheers,

Nikola


author: Dominic Lagger
body: Hi [@Nikola Gaydarov](/t5/user/viewprofilepage/user-id/4974377)

For myself I did not try this. It was just a suggestion, which had to be proven :)


Tags: roadmap

script