user1409217
user1409217

Reputation: 412

Notes link to open document from other database using XPage in current database

I have an application with 2 database. NSF1 contains only the design (Xpages, script library etc) and NSF2 contains everything including the data. User only have access to NSF1 and any document in NSF2 will be displayed through NSF1 XPages.

In the email for document approval sent to the reviewer, I'm including 2 links. One for the normal http (web browser) link and one is the notes link. The script fr this is in NSF1.

I don't have problem with the http link. It's something like the following and it works:

http://www.nsf1hostname.com/xsp/nsf1server!!nsf1.nsf/xpage.xsp?databaseName=nsf2server!!nsf2.nsf&documentId=AAAEXAMPLEONLY08283162&action=editDocument

But I'm stuck in constructing the notes link. In my previous application where everything (design & data) in one NSF, I can just use doc.getNotesURL() and I'll get a link like the following:

notes://nsfserver/nsf.nsf/0/UNIDOFTHEDOCUMENT0123456789?OpenDocument

If I use the above method, then the document will open using the XPage in NSF2 which is not what I want. I've tried the example here and did mine like

notes://nsf1server/nsf1.nsf/xpage.xsp?OpenXPage&documentId=UNIDOFTHEDOCUMENTINNSF2

but it doesn't seem logical to me because the server and database of NSF2 is not specified in the link and I don't know where to put those 2 parameters or if they're even allowed in the link. Clicking on the link will only result in empty XPage because ti doesn't know the UNID. So anyone had any idea?

Upvotes: 0

Views: 1738

Answers (2)

David Navarre
David Navarre

Reputation: 1022

I believe that all you have to do when you're indicating your data source is to specify which database you're pulling it from.

The code fragment below is in use within a panel in a custom control in our shared resources database. You could determine the documentId in any programmatic way you want, including passing it as an parameter in the Notes URL. The same holds true for the database name.

    <xp:this.data>
        <xp:dominoDocument var="poDoc" formName="PurchaseOrder"
            action="editDocument" documentId="#{javascript:sessionScope.newPODocUNID}">
            <xp:this.databaseName><![CDATA[#{javascript:getDb("tamisDb")}]]></xp:this.databaseName>
        </xp:dominoDocument>
    </xp:this.data>

This code wasn't written by me, but by the folks at Teamwork Solutions. In specific, my guess would be that Henry Newberry wrote it. It's part of a rather interesting design - XPages in the shared resources database, data in main, then attachments and workflow (config and tracking) in two other databases.

In my opinion, XPages really is intended to be used with design and data separate, data also being diffuse (maybe even in non-Notes locations!)

Upvotes: 1

Tim Tripcony
Tim Tripcony

Reputation: 8086

At a minimum, you'll also need the action parameter, because otherwise the data source uses the action specified in the design, which by default is createDocument. This would cause documentId to be ignored, since new documents are always assigned a new ID. Specifying an action (e.g. openDocument or editDocument forces the data source to also look at documentId (and, if provided, databaseName) to determine which document is being accessed.

Upvotes: 2

Related Questions