Hi All
I have an xpage (XPINC) with a button from where I'd like to open a particular document within the notes client. The db referenced below in the button's SSJS is in a different database to the xpage & button. Unfortunately I'm getting a "The document specified by the link cannot be located within the linked-to database." error when running the view.postScript("window.open('" + cdoc.getNotesURL() + "')") code. Now if I leave the page and open the db (and either leave it open or close it) via the notes client and then go back to the xpage and click the same button, it opens the cdoc no problem in the notes client UI. From then, every time I click the button it works UNTIL I restart the notes client then it no longer works.
var db:NotesDatabase = session.getDatabase(viewScope.get("SVR"),viewScope.get("PATH"))
if (db != null){
var vw:NotesView = db.getView("LookupDocs")
var cdoc:NotesDocument = vw.getDocumentByKey(document1.getItemValueString("itemRefence"))
if (cdoc != null){
view.postScript("window.open('" + cdoc.getNotesURL() + "')")
}
else {
view.postScript("alert('Document not automatically found - please try a manual search ');");
}
}
else {
view.postScript("alert('Database on " + viewScope.get("SVR") + " cannot be found automatically.');");
}
In testing if I try the button in the same db as the cdoc (ie var db:NotesDatabase = session.getCurrentDatabase()) - it works no problem. Also if I have a if (db.isOpen()) statement, it passes through that fine and into the relevant code.
Does anyone have any ideas of how to get around this?
Regards
Steven