Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Get the last modify date for a page

Lauras Susa June 29, 2023

Hi, 

Macro which shows last page last modify day  not worki.ng anymore. Code below. Could it be related with Confluence upgrade, it was upgraded to   8.2.1 

Thank you 

 

## Macro title:lastmodified
## Macro has a body: N
## Body processing: Selected body processing option
## Output: Selected output option
##
## Developed by: Lars Bjerges
## Date created: 26/06/2017
## Installed by: Lars Bjerges
## Get the last modify date for a page
## @noparams
$action.dateFormatter.formatDateTime($content.getLastModificationDate())

1 answer

0 votes
Evgenii
Community Champion
June 29, 2023

Hi, @Lauras Susa 

Please, try this

## Macro title: changedate
## Macro has a body: N
## Made by Evgeniy Isaenkov
## @noparams

$action.dateFormatter.formatGivenString("dd-MM-yyyy HH:mm",$content.getLastModificationDate())

 

Checked it, it works in 8.22+ versions

Evgenii
Community Champion
June 29, 2023

p.s. BTW, your script is working too.

Lauras Susa June 29, 2023

Hi @Evgenii 

Thank you for your reply. In Both cases are not working :( Macro config. I compered with other macros config and is the same. But only this one not working.  

conf.JPG

Nic Brough -Adaptavist-
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.
June 29, 2023

I have the same problem as @Evgenii - both your macro and theirs are working fine for me.

But, could you

  • tell us what the errors you get are (Actually, you may not get any errors, I'm probably looking for more of a description of what you actually get when viewing a page where the macro is used)
  • try the different rendering options?  I know "no macro body" is the right one for this, but the others can give more information about the problem, even when the body is empty
Lauras Susa July 4, 2023

Hi Nic, 

Thank you for suggestion. I tried all Macro Body Processing option with Evgeniy code and my.  Always result the same. That's really strange, that only one of User Macros stopped working. Other works as expected. 

last.JPG

Nic Brough -Adaptavist-
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.
July 4, 2023

Ok, I think this one needs to go to Atlassian support.

Although I would try one more thing - delete the macro, then recreate it with the same name (so as not to disrupt any pages using it). 

Don't copy and paste the code though, there might be something invisible in it that is breaking it.

What you're seeing is what happens when velocity can not run the code you are invoking, and in this case, I can't see what is wrong with any of the code you've tried.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.2.1
TAGS
AUG Leaders

Atlassian Community Events