Nov 15, 2012, 10:35 AM
37 Posts
topic has been resolvedResolved

Open XPage with a key, not a UNID?

  • Category: Server Side JavaScript
  • Platform: Windows
  • Release: 8.5.3
  • Role: Developer
  • Tags:
  • Replies: 5
 Hello, all!
   I've searched the forum, but haven't found anything very useful about what I want to do.  Basically, in traditional Domino, you can have a view, sorted by a unique key to open a specific document on the web, using that view and that key.  So, if each user of an application has one document, a URL could be "http://servername/db.nsf/nvUsers/John+Smith/ACME".  If the nvUsers view were sorted with the abbreviated name, this would work fine in previous versions of Domino.
   How can we do the same in XPages?  Right now, I'm doing a lookup in the view, based on the abbreviated user name, returning the UNID, and opening it that way.  Seems to be overkill for something that was so simple and straight-forward in traditional web development.
Any ideas? 
Steve in NYC 
Nov 16, 2012, 2:02 AM
129 Posts
Re: Open XPage with a key, not a UNID?
Computing the UNID for the document data source is probably the only way, as the data source needs the UNID.
Another way would be to wrap the document in a bean, but you would probably run into "object has been recycled" issues. 
What I tend to do is to have a object classes which represents the documents and a controller bean that handles events/validation for each kind of document. The controller bean uses a generalized DAO (Data Access Object) class to  pull/push data to the server on load/save. It takes a lot more time to write, but you also get a lot more control.
Nov 16, 2012, 10:53 AM
589 Posts
Re: Open XPage with a key, not a UNID?
 I don't think there's a way to do it like you want.  If you want to use your own key you need to then basically get the key and then do a lookup to get the UNID.  I prefer having key's based on @Unique rather then UNID's so I have done that in the past myself.  It;s not the end of the world I don't think.
Nov 18, 2012, 4:55 PM
1 Posts
Re: Open XPage with a key, not a UNID?
You can try to combine traditional features of domino development with the XPages - create a separate form and set an option to use your XPage instead, then in your view set the form formula to the newly created form. Documents, opened from this view should teoretically be opened in appropriate XPage.
Nov 19, 2012, 12:15 PM
37 Posts
Re: Open XPage with a key, not a UNID?
   Thanks, all.  I have many existing web based Notes applications that have easy to remember URLs for users.  For example, "http://server/db.nsf/links/keyInfo".  So, in the new "improved" version, the URL will be "http://server/db.nsf/form.xsp?documentID=1234567890ABCDEFGHIJKLMNOP&action=openDocument".  So much for making it easier for users.  :(
   For all the improvements in XPages, it seems that a lot of things that were previously easy to do have been forgotten or omitted. 
Take care! 
Steve in NYC 
Nov 21, 2012, 1:15 AM
129 Posts
Re: Open XPage with a key, not a UNID?
I forgot one thing. If you set the form to automatically open document in a XPage (Form properties), I believe you can use traditional URLs.