Hi,
I've had a request from one of my users to create a script on our hosted
wiki that will create all the needed wiki content for one of their
lists.
* Problem 1, there is over 2000 xwiki documents to create from
this list
* Problem 2, they're a little anxious to get it going
I've tried using the $xwiki.createDocument in the underneath code (most
likely more saves than necessary).
What seems to be happening is this:
* Does not create a new document, attaches instead to
XWiki.WebHome
* All following changes occur to XWiki.Webhome - including rename.
Origionally had it saving after each change, no difference.
#set($seedForUnique=$xwiki.formatDate($xwiki.currentDate,
"HHmmssddMMyyyy"))
#set($userUnique=$context.user.replace("XWiki.", ""))
#set($generatedUnique="${userUnique}${seedForUnique}")
#set($baseAVLClass='XWiki.AVLEntryClass')
#set($baseSupplierClass='XWiki.VendorClass')
#set($newSupplierPartClass='XWiki.AVLVendorClass')
#set($newDocument=$xwiki.createDocument())
$newDocument.rename($generatedUnique)
$newDocument.setContent('#includeForm("AVL.VendorClassSheet")')
$newDocument.createNewObject('${baseSupplierClass}')
$newDocument.save()
#set($docObj=$newDocument.getObject('${baseSupplierClass}', 0))
$docObj.set('name', 'Samsung')
$docObj.set('email', '')
$newDocument.save()
I would guess I'm not doing a crucial step (or doing that step wrong)?
Better suggestions welcome too :)