Update a field on a Open doc from another open doc

Posted on 2004-09-02
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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

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 500 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

777 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