Dear all,

I am trying to create a document from a page, with a template and an 
object attached, but without having to quit the said page.

I generate fine the new document and the object with the values i want 
for the properties, but i did not succeed in putting text in the 
document, i tried using $newDoc.setDefaultTemplate and 
$newDoc.insertText but no success at all.

I post here my piece of code, any hint will be appreciated (after a few 
hours on this, i am a bit lost):

#if($createDomain!="")
  #set($newDoc=$xwiki.createDocument())
  #set($newName="Project."+$newDomainId)
  $newDoc.rename($newName)
  $newDoc.insertText("#includeForm(\"XWiki.DomainClassSheet\")","")
  #set($newDoc=$xwiki.getDocument($newName))
  #set($newObject=$newDoc.newObject("XWiki.DomainClass"))
  $newObject.set("id",$newDomainId)
  $newObject.set("name",$createDomain)
  $newDoc.save()
#end

Jean

-- 
----
Jean Couteau
Code Lutin - http://www.codelutin.com
44 Bd des Pas Enchantés - 44230 St-Sébastien/Loire
Tél : 02 40 50 29 28 - Fax : 09 59 92 29 28 

_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to