This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Dec 1, 2011, 3:02 PM
17 Posts

get NotesUIWorkspace or NotesUIDocument from XPage, hybrid applications?

  • Category: APIs
  • Platform: All
  • Release: 8.5
  • Role:
  • Tags: NotesUIDocument,NotesUIWorkspace
  • Replies: 6
I got an XPages application that in particular case runs on Notes client.
 
What I want to do is to create a document in another database, pre-fill some fields and then without saving open the document using the form from that database. In normal notes I would write a code:
 
    Dim ws As New NotesUIWorkspace
    Set ndb = New NotesDatabase("server", "dbname.nsf")
    Set doc = New NotesDocument (ndb)
    doc.Form = "Reservation"
    Call ws.Editdocument(true, doc)
 
I can create a new document via the backend JavaScript, but I cannot open it unless I save it first (and then open via url).
 
If I put the code above in agent and try to call it from XPage it does not work as it executes as a "server" agent and thus cannot use UI classes. I also do not manage to execute the agent by calling it via Notes url - it seems once I'm in XPage I have no way to open a normal notes element in the same database.
 
I would be happy with the other approach where I create a new document in UI via notes url (open form), then grab UIDoc and fill the fields. However I do not seem to find how to do it as well.
 
 
 
 
Dec 1, 2011, 3:32 PM
298 Posts
Composite Application?
Maybe a composite app where your XPage triggers an action in the Notes component that did the displaying of the document would work? Howard
Dec 2, 2011, 9:56 AM
17 Posts
Re: get NotesUIWorkspace or NotesUIDocument from XPage, hybrid applications?
thanks for the idea. Not sure if I can. I need to create a new doc in an other db, prefill fields based on the selected doc in XPage app, not save it, but open with its native form. I do not think I can open an unsaved doc in another frame of composite application if I cannot do it in the current one. Moreover I cannot modify the other database to fit within the composite app.
Dec 2, 2011, 11:25 AM
53 Posts
Re: get NotesUIWorkspace or NotesUIDocument from XPage, hybrid applications?
What I've done before:
 
Create the document and save it, also set a field NotSaved to Y. When the document is opened, if it's saved then in the save button change that field back to Y. If the user clicks cancel then delete the doc. You could then run a clean up agent to clear any doc that was just closed without saving (there may be a way to clear these up on close, not sure). You can also update view selection formulas not to include any docs with NotSaved set to Y
 
 

Dec 2, 2011, 12:17 PM
17 Posts
Re: get NotesUIWorkspace or NotesUIDocument from XPage, hybrid applications?
thanks, but as I said it's important not to save the document. The other app is owned by other people, so no messing around with their design. All my code does is help to prefill some fields and leave all validation to the original app.
 
The solution I finally found is to put the doc creation and opening code in an agent. I cannot launch this agent directly from XPage even by using notes:// url (I get "Command not implemented" error), however I can use notes:// url to open another Notes native element such as a page, put a line source.close in the PostOpen event and in QueryClose call the agent. Kind of doing simple things the hard way, but at least it does what I need :-) Will try to figure out now how can I pass info which context doc to use, but I assume passing the url parameters should work well enough.
 
EDIT: Well a bit naïve from my side. @urlquerystring does not seem to work with Notes url. Some more hack needed :-)  I guess from XPages I cannot use notes.ini as well... can I? so have to pass the info through some data document.
Dec 5, 2011, 9:24 AM
272 Posts
Re: get NotesUIWorkspace or NotesUIDocument from XPage, hybrid applications?
Hi,
 
I don't know if you have already found your solution, but what if you use the notes.ini?
You can use session.setEnvironmentVar() in the XPage and set the values you need. Then you can easily access them in the form.
 
Hope this helps
Sven
 
Dec 7, 2011, 1:01 PM
17 Posts
Re: get NotesUIWorkspace or NotesUIDocument from XPage, hybrid applications?
Thanks Sven. This changes my idea about how XPages work.
 
I was pretty sure that the server side script executes on server, so setEnvironment will end up on server. But once I tried session.setEnvironmentVar() the value ended up in the client notes.ini.
 
But for my problem - I decided that it suits me very well to write a data document in the current database, then pass notes url command to open this document. And the form contains a code to close this document at once and from QueryClose run an agent providing this data doc as parameter.

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal