Update a field on a Open doc from another open doc

Posted on 2004-09-02
Medium Priority
Last Modified: 2013-12-18
Hi Guys


I know how to open and populate fields between two databases. No problem


I have a form open

Push a button it launches a form within the same database
I now have two documents open
When a button is pushed on the most recently opened doc I need it update a field on the document that is lurking in the backgroud. The document would then close and leave the main document to be completed
Question by:imjamesw
  • 6
  • 5
LVL 46

Expert Comment

by:Sjef Bosman
ID: 11963391
Maybe easy enough: communication is possible, because the parent of the newly opened form can use the uidoc of that form.

See ws.editdocument, how it kan return the uidoc of the new form
LVL 63

Expert Comment

ID: 11965645
Is this a web application?

Author Comment

ID: 11968152
No this is a notes application
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

LVL 46

Expert Comment

by:Sjef Bosman
ID: 11970829
Then read the Help about the EditDocument method of NotesUIWorkspace. It makes it possible that a LotusScript function on a parent form interferes directly with the newly edited form.The other way round is not possible, the child form cannot set values in the parent form in any way. Some examples of using this technique:

Edit the child document, use the returned uidoc to set the name of an Environment variable that contains the UniversalID of the current document. If both forms are to be open at the same time, this won't work, because only the database document will be updated, not the parent form on screen.

Edit the child document, use the returned uidoc to set a (hidden) field with a state, the states being
NOTATTACHED (default state): if the form is used without having been opened by the parent, there is no data exchange required
ATTACHED: requests the child form to set the state to UPDATED whenever the content of some fields have been changed
UPDATED: signals the parent form that fields have been updated, to be copied to the parent form; the state could be reset to ATTACHED afterwards
QUERYCLOSE: the child form is not permitted to close without the parent form's consent
CLOSE: the child form can close now

The parent form has to verify regularly the state of the field and act accordingly. The only way to do this is to use a NotesTimer (my favourite!).

Totally different and more difficult approach, albeit using the same technique but only possible in R6: use the universal-ID of a profile document that can be used to Lock and Unlock critical sections. The ID can be passed to the child form using the uidoc of the child, as above. The child form will then open the profile document created by the parent form, even data can be exchanged using the profile document.

There may be other ways to accomplish what you want, but what's the approach you prefer? Or do you have one of your own?

Author Comment

ID: 11996796

Here is what I was thinking

If I grab the UNID of the parent and set it in the child

The child uses the UNID as a handle back to the parent

Create a Parent Doc (Not Saved at this point)
Push button to open child
Push button on child to send mail and to set field on parent then close (Not Saved)

I can set the Parent UNID I see it on the form

I seem to be unable to write back to the parent

Set Parent = db.GetDocumentByUNID(doc.ParentUNID )
            Parent.CertSent = Now


LVL 46

Expert Comment

by:Sjef Bosman
ID: 11996875

> The child uses the UNID as a handle back to the parent
> Push button on child to send mail and to set field on parent then close
Setting a field on the parent won't work, that's what I said above! The parent can set a field on the child document, not the other way round. By the way, if you don't save the parent document, it will not have a Universal-ID.
> I can set the Parent UNID I see it on the form
> I seem to be unable to write back to the parent


Author Comment

ID: 11997537
HEy Sjef

What if we wrote the value I need to a Env variable and then after the child close refresh the field to look up the env if it is there
LVL 46

Expert Comment

by:Sjef Bosman
ID: 11997747
Yes, you cold do that, but I ALWAYS try to avoid env. variables. If all else fails, then use them. But still, that value can only be set if the parent is saved.

I might have a better approach for you! What if you create the child document by means of a DialogBox, and let the parent update itself using the appropriate mechanism (RefreshParentNote)? You might wonder, but it is possible to save a document from a DialogBox!

Author Comment

ID: 11998626
Will the dialogbox send mail when the button is pushed

I do not thinkso as I do not think I can use form buttons within a dialogbox
LVL 46

Accepted Solution

Sjef Bosman earned 2000 total points
ID: 11998649
Form buttons not, but Hotspot-buttons will work. Most important drawback: you don't have both the parent and the child open for update, since the DialogBox is modal.
LVL 46

Expert Comment

by:Sjef Bosman
ID: 12013637
Ah! Did you succeed this way? Using a DialogBox?

Author Comment

ID: 12019007

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
Watch the video of Kernel Migrator for SharePoint, which demonstrate the process easily of migration from SharePoint to SharePoint, OneDrive for Business & Google Drive servers, Public Folder to SharePoint, File Server to SharePoint. The tool has va…
To export Lotus Notes to Outlook PST or Exchange and Domino Server files to Exchange Server or PST files with ease, go for Kernel for Lotus Notes to Outlook conversion tool. Through the video, you can watch the conversion process. A common user with…

589 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question