xpages - Create an iconNote Document in a new database -
this more explicite extension on previous question.
from button on xpage create new database
targetdb = dir.createdatabase(filename);
i copy bunch of stuff targetdb sourcedb. want set launch properties in targetdb problem comes. know can iconnote = targetdb.getdocumentbyid("ffff0010") except there no icondoc in target. have way create doc specific noteid?
i tried copying iconnote document sourcedb targetdb not work. changes unid , noteid. can't find database method create icon note.
found lots of stuff on how change settings in iconnote, nothing on how create 1 if there not 1 in database.
thanks jesse took code , changed ssjs , works fine.
var dir:notesdbdirectory = session.getdbdirectory("development"); var newdb:notesdatabase = dir.createdatabase("xpages/install/created.nsf"); var importer:notesdxlimporter = session.createdxlimporter(); importer.setdesignimportoption(6); var dxl:string = "<?xml version='1.0'?>\n" + "<note default='true' class='icon'>\n" + " <item name='$title'>\n" + " <text>test title</text>\n" + " </item>\n" + " <item name='$flags'>\n" + " <text>j7nzq?!</text>\n" + " </item>\n" + "</note>\n"; importer.importdxl(dxl, newdb); var iconnote = newdb.getdocumentbyid("ffff0010"); iconnote.replaceitemvalue("$defaultxpage", "xpwfsdemo.xsp"); iconnote.replaceitemvalue("$defaultclientxpage", "xpwfsdemo.xsp"); iconnote.save(); dbar.info(iconnote.getitemvaluestring("$flags"));
something oughta it:
dbdirectory dir = session.getdbdirectory(null); database newdb = dir.createdatabase("tests/created.nsf"); dxlimporter importer = session.createdxlimporter(); importer.setdesignimportoption(dxlimporter.dxlimportoption_replace_else_create); string dxl = "<?xml version='1.0'?>\n" + "<note default='true' class='icon'>\n" + " <item name='$title'>\n" + " <text>some db title</text>\n" + " </item>\n" + " <item name='$flags'>\n" + " <text>j7nzq?!</text>\n" + " </item>\n" + "</note>\n"; importer.importdxl(dxl, newdb);
that's 2 "open xpage" options set - include 2 xpage name items same way, , may idea export icon note existing db (database.getdocumentbyid("ffff0010").generatexml()) , paste in actual icon item well, since dxl result in icon-less database. nonetheless, seems work in testing basis.
and after point, you'll able fetch icon note using usual "ffff0010" pseudo-id , replace item values same way mentioned before.
Comments
Post a Comment