Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to access ContentService or ContentPropertyService via ScriptRunner


I'm hoping someone can suggest how to achieve this. I want to use the ContentProperty to store some values for a Confluence page, but can't get a handle on either the ContentService or the ContentPropertyService.


I'm using Confluence 7.10.2 and ScriptRunner 6.21.0.

I can get an instance of both services via

@Field ContentService contentService = ComponentLocator.getComponent(ContentService, 'apiContentService');

@Field ContentPropertyService contentPropertyService = ComponentLocator.getComponent ContentPropertyService;

using this, I can successfully create and add a new property via contentPropertyService.create( myNewProperty )

however I'm unable to use .find to access the ContentPropertyFinder as

ContentId contentId = ContentId.of(pageId)

def found = contentPropertyService.find().withContentId(contentId).fetchOne();

groovy.lang.MissingMethodException: No signature of method:  com.sun.proxy.$Proxy260.withContentId() is applicable for argument types: ( values: [ContentId[id=19071593}]

And I have a similar issue with ContentService

def page = contentService.find().withId(ContentId.valueOf(pageId as String)).fetchOneOrNull();

which crashes out in a similar manner

groovy.lang.MissingMethodException: No signature of method: com.sun.proxy.$Proxy217.withId() is applicable for argument types: ( values: [ContentId{id=19071593}].

Possible solutions: with(groovy.lang.Closure), with(boolean, groovy.lang.Closure), wait(), find(), wait(long), find([Lcom.atlassian.confluence.api.model.Expansion;)

If I try and call .find with null or an Expansion, I get

java.lang.IllegalArgumentException: interface com.atlassian.confluence.api.service.content.ContentService$ContentFinder is not visible from class loader


I believe my issue is due to Spring/autowire and Groovy's proxy getting in the way of each other but I'm at a loss as to how to resolve this.

1 answer

1 accepted

1 vote
Answer accepted

For anyone else who has this issue, the answer appears to be to explicitly set the Expansions, which where trial-and-error.


def found = contentPropertyService.find(new Expansion('content'), new Expansion('version'))


does the trick

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Confluence

⚡️NEW Group for Confluence Cloud Admins

Calling all Confluence Cloud Admins!  We created a new Community Group to support your unique needs as Confluence admins. This is a group where you can ask questions, access resou...

109 views 2 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you