I’d like to be able to use the [compose] command and have the new doc automatically inherit the field values from the selected document. (my form property is set to inherit)
My embedded view has 3 different types of docs in it (forms), so I first need to determine which kind is selected, so I can call [compose] with the right form name.
I’ve got my view action using LS to get the form name, and then saving it in the ini file. Then, I call a formula agent to do the [compose]. But, this isn’t working.
Am I going about this the wrong way? Is there a way to do inheritance in LS directly? (without naming each field individually)
Subject: Embedded views and inheriting field values with LS
Robert,
The usual way to do it is to set the Default value for the field on the inheriting form to equal the name of the field on the form you are inherting from. There should be no need for the button to do anything other than @Command([Compose]; “formName”)
HTH
Mark.
Subject: But I need to compose the right form
I have 3 different forms displayed in my view. So, before I can call the compose command, I have to determine which form to compose. I guess I could just put 3 different actions on the view, but then I’d be relying on the users to select the right one. Not likely.
Subject: RE: But I need to compose the right form
Robert,
Try this behind the Action button on your embedded view (not tested):
Set ws=New NotesUIWorkspace
Set s=New NotesSession
Set db=s.CurrentDatabase
Set dc=db.UnprocessedDocuments 'Selected in view
Set docParent=dc.GetFirstDocument
Select Case docParent.Form(0)
Case "Form1":
'Compose Form 1 and Set default values from Form 1
Set uidoc=ws.ComposeDocument(strServer, strFilePath, "Form1")
Call uidoc.FieldSetText("FieldX", docParent.FieldX(0))
Case "Form2":
'Compose Form 2 and Set default values from Form 2
Set uidoc=ws.ComposeDocument(strServer, strFilePath, "Form2")
Call uidoc.FieldSetText("FieldY", docParent.FieldY(0))
Case "Form3":
'Compose Form 3 and Set default values from Form 3
Set uidoc=ws.ComposeDocument(strServer, strFilePath, "Form3")
Call uidoc.FieldSetText("FieldZ", docParent.FieldZ(0))
End Select
Subject: PERFECT! Actually, it worked even easier…
I first tried the ws.composedocument without setting any fields, and they inherited their values just as they would with the [compose] command! So, I’m all set. Thank you very much!