Need help badly! Lotusscript mail

Hi all,

I have two forms.

Form A has two fields which uses @picklist for the users to select user addresses to send to. There is also a save button.

On form B i have a couple of embedded views, an action button with some lotusscript to send and email and two fields. Now these two frields ‘Approver1’ and ‘Approver2’ are both computed and inherit the values from form A.

The only problem is that the users have to go to form A and click on the action button to open form b in order to inherit the values and for the mail script to work.

Ideally i would like it so that the users dont have to open form B up by going to form a so can anyone help me with my code and get it to work.

If i open form B up and try to send the email nothing happens because the values are not being inherited.

this is the lotusscript code i am using:

Sub Click(Source As Button)

Dim session As New NotesSession

Dim db As NotesDatabase

Dim ws As New NotesUIWorkspace

Dim uidoc As NotesUIDocument



Set db = session.CurrentDatabase

Set uidoc = ws.CurrentDocument



Dim bodyRTF As NotesRichTextItem

Dim emailMsg As New notesdocument(session.CurrentDatabase)

Set emailMsg = New NotesDocument(session.CurrentDatabase)



If Trim(uidoc.FieldGetText("Approver1")) <> "" Then

	emailmsg.sendTo = uidoc.FieldGetText("Approver1")

	emailmsg.subject = "FYI: Checklist Completion"

	

	Set bodyRTF = emailMsg.CreateRichTextItem("Body")	

	Call bodyRTF.AddNewline(1)

	Call bodyRTF.AppendText("Hi,")

	Call bodyRTF.AddNewline(2)

	Call bodyRTF.AppendText("This email has been sent on the basis that the following checklist tasks are complete.")

	Call bodyRTF.AddNewline(2)

	Call bodyRTF.AppendText("Please follow the link for details regarding the completed checklist...")

	Call bodyRTF.AddNewline(2)

	Call bodyRTF.AppendDocLink(uidoc.Document, "Please follow the link for details regarding the completed checklist")

	

	Call uidoc.save

	Call emailMsg.Send(False)

Else

	Msgbox("ERORR: SendTo field is blank and therefore cannot send mail.")

End If

End Sub

Despite the address saved and stored in the fields on form A…if i go straight to form b and try to send the mail my msg box appears due to the values not inheriting…

is there away round this to make it possible.

Im not great at writing code so any help would seriously be appreciated.

Thank you so much

Subject: Need help badly! Lotusscript mail

Don’t fully understand why you’re doing what you’re doing (inherit vs lookup?)

I’ve developed many work flow applications where you have a lookup document that given a certain key it look-up who the approvers of the document might be. For example given a particular Business it requires manager1 and manager2’s approval. This would be your Form A.

In your Form B, I would select a business and then given that business I would do a look-up and get manager 1 and Manager 2 names from Form A.

What I don’t see in your explaination is how / what is the key? It seems to depend upon the user going into Form A to create Form B so the values can inherit. If there was a “key” the system could do this for the user / you. Is there a key?

Or is there just one document for Form A?

Subject: RE: Need help badly! Lotusscript mail

Hi thanks for your response.

Found a solution to the problem…

I hadn’t used the @GetProfileField in the two fields on form B to inherit the values.

Works brill now