Forums

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

Display Spaces Vuew Report using ScriptRunner with Data Center version 9.2.19

Kathy Dickason
Contributor
July 14, 2026

I have Confluence Data Center 9.2.19 and ScriptRunner 9.33.0.  I am trying to generate a Display SpacesView Report like shown here:  https://www.scriptrunnerhq.com/help/example-scripts/spaces-view-report-onPrem

This script is for older version, it appears, and when I attempt to run it, I get no script errors, but after running it, I see this:  Cannot invoke method getAt() on null object (see screen attached).  Can someone help me fix this so it will run?  Thank you!error.png

 

2 answers

1 accepted

0 votes
Answer accepted
Viswanathan Ramachandran
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 Champions.
July 14, 2026

Hi @Kathy Dickason 

  • did you check the logs? 
  • also, Confluence 9.x has changed the REST endpoints, did you modify that?
  • did you access the URL endpoint in the browser and it returns? 
0 votes
James Gamble
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 Champions.
July 14, 2026

Hola Kathy,

@Viswanathan Ramachandran's suggestion to check the logs and test the endpoint is a good place to start, but the exact error may be caused by a null value in the example script rather than the REST endpoint itself.

The ScriptRunner example includes this line:

td { p(space?.lastViewedAt[0..9]) }

If one of the spaces doesn’t have a lastViewedAt value, Groovy tries to apply [0..9] to null, which results in a Cannot invoke method getAt() on null object error.

Try replacing it with:

td { p(space?.lastViewedAt ? space.lastViewedAt.take(10) : "Never viewed") }

I’d also make the returned list null-safe:

def activityBySpace = result?.activityBySpace ?: []

That should prevent the script from failing when a space hasn’t been viewed or when the response doesn’t contain the expected list.

It would still be worth logging the response immediately after the request so you can see exactly what Confluence is returning:

log.warn("Analytics response: ${response.body()}")

Here is an example.

It appears to have been written and tested against older Confluence and ScriptRunner versions, so Confluence 9.2.19 may require additional changes. Confluence 9 introduced several platform and REST changes, but since this script is calling the internal confanalytics endpoint, I wouldn’t assume the endpoint changed until you confirm what it returns.

Thanks,

James

Suggest an answer

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

Atlassian Community Events