The two extra buttons that were above the Embedded view action buttons were "Refresh" and "Add Item".
They both referred to the current document and not the documents in the embedded view.
Just use notesuiworkspace.currendocument I was told, so I did.
- and it crashed Notes 7.0.3 client, and Notes 6.5.3 client
Turns out the trick is to have the actions in the embedded view run an agent.
So the refresh action button has code:
@command{[RunAgent];"{RefreshCurrentDocument)")
and the Shared "Agent List Selection" Target=None agent has the code:
Dim uiw As New notesuiworkspace
Dim uidoc As notesuidocument
Set uidoc= uiw.currentdocument
Messagebox "Uidoc form=" & uidoc.Document.form(0) & " unid=" & uidoc.Document.universalid
If uidoc.editmode=False Then uidoc.EditMode=True
If uidoc.editmode=True Then Call uidoc.refresh
So the code above directly in an embedded view action crashes notes, but put it in an agent and you are fine.
NB The "Agent List Selection" agent above can be called RefreshCurrentDocument as Notes will add the brackets.
and the Add item button has:
@command{[RunAgent];"{AddItem)")
and the Shared "Agent List Selection" Target=None agent has the code:
Dim uiw As New notesuiworkspace
Dim uidoc As notesuidocument
Set uidoc=uiw.currentdocument
Dim pdoc As notesdocument
Set pdoc=uidoc.Document
If uidoc.Document.status(0)="Approved" Then 'optional if statement
Messagebox "Sorry Already Approved!"
End
End If
If uidoc.EditMode=False Then uidoc.EditMode=True
If uidoc.IsNewDoc Then 'optional if statement
Call uidoc.Save()
End If
Dim doc As notesdocument
Set doc = New notesdocument(uiw.currentdatabase.database)
Call doc.MakeResponse(pdoc)
doc.form="Cash"
doc.parentunid=pdoc.universalid 'optional I added this
Dim uidoc2 As notesuidocument
Set uidoc2=uiw.editDocument(True,doc)
Call uidoc.refresh()
NB you do not need to save the document before editing it, very useful as the user may cancel the new document.
This works with response docs as well.