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

User macro - extract a number from space key and use that as date range for JQL?

Deleted user January 6, 2022

Hey guys,

I'm currently seeking help in a challenging task (at least for me) ;)

We have a Confluence space, that gets copied every year and where the copied space is then modified. These particular spaces also have the current year in its space keys, i.e. "wbk2022" for the new one, the one from last year would be "wbk2021". All pages in these spaces also include a user macro, that grab all relevant Jira issues, which relate to that space and where created that particular year.

Here's an example:
<ac:parameter ac:name="jqlQuery">project = WEITERBILD and "Titel des Training" ~ "$content.title" AND created >= 2021-01-01 AND created <= 2021-12-31</ac:parameter>

What we have to do every year, is copy that space with all its pages, create a copy of last years user macro and alter the date in that query. This is needed, because the "old" spaces need to be archived along with all referenced Jira issues of the corresponding year.

What I am trying right now is to extract the year from space key and use that information in my JQL query, therefore we would not need to create another user macro every year or alter all pages in the newly copied spaces.

I hope I was clear enough about my idea. Any help is highly appreciated ;)

Thanks and best regards
Sascha

1 answer

0 votes
Bill Bailey
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 6, 2022

Would something like this work?

#set($dateInfo=$action.dateFormatter.formatGivenString("yyyy", $space.creationDate))
Deleted user January 10, 2022

Thanks for your suggestion, I got it to work as I wanted in the first place, I just had a typo in my code... :(

I finally managed to extract the year from space key with a split() function, set my date range variables for the following JQL query and used these in my JQL:

<ac:parameter ac:name="jqlQuery">project = WEITERBILD and "Titel des Training" ~ "$content.title" AND created >= $start AND created <= $end</ac:parameter>

Like Dominic Lagger likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events