Lotus Script Mail function help

Hi All

I am trying to create a LotusScript function on the PostSave Event, which calls a Function CAlled Managers. This is used to send an email to the appropriate person.

What I have is a form with some fields, one of the fields is Department. Depending on what department is chosen,a mail will be sent to a certain manager who owns that department.

I have a profile form called SageProfile with two fields, IT and Accounts, each has a different name, so depending on what is chosen in the user form it will look up the SageProfile and pick the correct manager to send the email to. I have a snippet of the following code:-

Dim managers As NotesItem

If doc.GetItemValue( "Department" ) = "IT" Then 

	Set managers = SageProfile.GetFirstItem( "IT" )

Elseif doc.GetItemValue( "Department" ) = "Accounts" Then 

	Set managers = SageProfile.GetFirstItem( "Accounts" )

End If	

If( managers Is Nothing ) Then Exit Sub



 'Create new memo

Dim memo As New NotesDocument( db )

memo.SendTo = managers.Values

I get the following error

“Variant does not contain an object”

Sorry but I have never programmed in LotusScript so I am not really to sure what I am doing.

Regards

Douglas Bell

Subject: Lotus Script Mail function help

You referred to a variable of type Variant as though it contained an object reference, but no such reference has been assigned to it. For example:

Dim varV As Variant

varV.Something

you can use notes debugger

Fies-tools-debug lotuscript

Subject: Lotus Script Mail function help

Dim managers As stringIf doc.Department(0) = “IT” Then

managers = SageProfile.IT(0)

Elseif doc.Department(0) = “Accounts” Then

managers = SageProfile.Accounts(0)

End If

If managers=“” Then Exit Sub

'Create new memo

Dim memo As New NotesDocument( db )

memo.SendTo = managers