WEB - Create a new doc without closing the currently opened document

I have a document(DOC A) opened for editing with an embedded view.

I want to create an Action/hotspot on the document that will:

a. take some of the fields from the currently opened document

b. create a new document (DOC B) in the background and populate the document with the above field values.

c. Save the background document (DOC B) without displaying it.

d. Refresh the currently opened document (DOC A) and show DOC B in the embedded view.

Not sure what to search for on the forum. A Lotusscript or Formula solution would be ideal but any help would be appreciated.

Thanks

Subject: WEB - Create a new doc without closing the currently opened document

Sample code: make appropriate changes. This was to give idea.

==========

Sample code:

Dim ws As New NotesUIWorkspace

Dim session As New NotesSession

Dim cdoc As NotesDocument

Dim currdb As NotesDatabase



Dim uidoc As NotesUIDocument

Dim mdoc As NotesDocument 

‘Setting current doc

Set uidoc = ws.CurrentDocument

Set currdb=session.CurrentDatabase

CurrDocFirstField1 =uidoc.@FieldGetText

CurrDocFirstField2=uidoc.@FieldGetText	





Set mdoc= New NotesDocument (CurrDb)



          Set mdoc.Form=”YourForm”



         mdoc.field = CurrDocFirstField1



        ‘and so on



        Call mdoc.Save (True, True)

        Call uidoc.Close

	



End Sub

-=======

Imtiaz

Subject: WEB - Create a new doc without closing the currently opened document

This can be done using iFrames.

1 ) Declare an iFrame element on your Form A with no dimensions i.e. height=0 & width=0.Note that this iFrame will have No Source intially and will be assigned at “Run-Time” when Action/Hotspot is clicked.

  1. Instead of using Embedded view, call the same view using another iFrame ( this is 2nd iFrame on Form A ). This will allow us to refresh the view ( without re-loading the page ) once the new document is created.

  2. Create a new form (lets call is “FormC”), which will run a “WebQueryOpen” agent. This agent would grab values from the QueryString (use Query_String_Decoded) and create a notes document based on the parameters passed (field values from document A).

  3. A new document will be created in Step 3. Now the embedded view on document A needs to be refreshed to display the newly created document. On “onload” for FormC, re-assign the “Source” of embedded view.

Ashish

Subject: Still not working.

I am using the solution suggested by Imtiaz as it is identical to my first attempt at getting this right. I am also totally unfamiliar with iFrames and need this working very quickly.

I have added an Action Button to my Doc A that runs the following code:

Dim ws As New NotesUIWorkspace

Dim session As New NotesSession

Dim cdoc As NotesDocument

Dim currdb As NotesDatabase

Dim uidoc As NotesUIDocument

Dim mdoc As NotesDocument

Set uidoc = ws.CurrentDocument

Set currdb=session.CurrentDatabase

actionSubject = uidoc.FieldGetText(“Action_Subject”)

mainID=uidoc.FieldGetText(“MainID”)

Set mdoc= New NotesDocument (CurrDb)

mdoc.Form=“WA - Contact Actons”

mdoc.MainID=mainID

mdoc.Action_Subject = actionSubject

Call mdoc.Save(True, True)

Call uidoc.Refresh

All that happens is that the uidoc(Doc A) is refreshed without the Doc B being created and therefore not displayed in the embedded view on Doc A.

Is it correct to use an Action Button on Doc A? I don’t want the code to run on the WebQuerySave event as I don’t want to create a new Doc B each time I edit Doc A.