I’m getting the UNID using…
docID := @DbLookup(“” : “”; “” : “”; “LookupTable”; nameVar; 2);
…where the 2nd column is @Text(@DocumentUniqueID)). A prompt displaying the result shows that this part works. But then the open document command fails…
@Command([OpenDocument]; “0”; docID)
The error I get is Cannot execute the specified command.
I’ve tried changing “0” to “” (as shown in Designer Help), but that didn’t work.
The UNID supplied to the OpenDocument command is supposed to be text (which it should already be here), but I’ve tried putting it inside @Text to be sure. I’ve also tried using [RETURNDOCUMENTUNIQUEID] in the @DBLookup formula – even nesting this inside the OpenDocument command.
What am I missing?
Subject: Can’t open doc with @Command([OpenDocument]… and UNID
I believe you need to have a default view set in your database. Have you done this?
Subject: RE: Can’t open doc with @Command([OpenDocument]… and UNID
Yes, a default view is set, but I still need to open a view before the document.
Subject: SOLUTION: Can’t open doc with @Command([OpenDocument]… and UNID
Probably too late for you Marc, but you can do this with @UrlOpen using the notes:// rather than http:// protocol, for example…
@UrlOpen(“notes://”+@name([CN];@servername)+“/”+@webdbname+“/”++“/”+@text()+")
I needed to do this to open a single document from an outline entry, when opening the view first wasn’t really an option.
Subject: Can’t open doc with @Command([OpenDocument]… and UNID
I think I found it. Before calling the OpenDocument command, I first need to call an OpenView command using a view that contains the document.
So I know this works, but is it necessary?
Subject: RE: Can’t open doc with @Command([OpenDocument]… and UNID
If you want to open a document using formula language, yes, you have to open the view first.
Depending on what you do with the document after it’s open, you could open it with LotusScript instead.
You could retrieve the document you want in LotusScript using either:
NotesView.GetDocumentByKey (assuming you have a lookup key); or
NotesDatabase.GetDocumentByUNID (assuming you have the unique id).
Then you can use NotesUIWorkspace.EditDocument to open it. This does not require a view to be open in the UI.
Note this only works in the Notes client (not on the web), and and if you use attempt to use @Command([ViewSwitchForm]) after the document is open, that command will fail. All other @commands should be fine, and I can’t think of any other issues.
Subject: RE: Can’t open doc with @Command([OpenDocument]… and UNID
Cool. Thank you!