Ajdin Brandic wrote:
Hi
I'm trying to execute another script on "Save" event. I've created a notification class (based on xwiki example http://dev.xwiki.org/xwiki/bin/view/Drafts/GroovyNotifications) and pointed to it in "Administration > Programming > Notification pages".
This script gets called every time which is fine and when I try to display name of a document that is being saved (doc.fullName) all works well. document name it works fine but when I try to display one of the fieldnames doc.display('Summary') I get
groovy.lang.MissingMethodException: No signature of method com.xpn.xwiki.doc.XWikiDocument.display() is applicable for argument types: (java.lang.String) values: {"Summary"}
I tried def tmpDoc = context.getWiki().getDocument(doc.fullName, context); But again fullName is OK but display('Summary') isn't
Am I missing something in my syntax? How do I make document values available in my Notification class?
As you see, that is not an api object, but an internal class (com.xpn.xwiki.doc.XWikiDocument vs. com.xpn.xwiki.api.Document). This means that API methods don't work, unless they have an equivalent in the other class. You can either look at the methods of the XWikiDocument class, or get an API object and work with it (new com.xpn.xwiki.apiDocument(tmpDoc) -- Sergiu Dumitriu http://purl.org/net/sergiu/