Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LotusScript - setting value of doc.sendTo field

Status
Not open for further replies.

DoctorGonzo

Programmer
Jan 23, 2004
48
GB
Hi all, I hope someone can help.

Firstly, apologies for the length of this mail, and I only post this after having tried deigner help and the web....

Problem :
I have a computed field called "recipients".

it's a Text field, computed when composed, multivalue with comma as the seperator.

It does a look up and populates based on a role.

So, at the moment it looks Like this (value)

John Doe/xxx/xxx, Jim Smith/xxx/xxx

This is quite fine.

The formula for the computation is this :

thisvalue:=
@If(@IsMember("[Role1]"; @UserRoles);
@DbLookup("":"NoCache";@Subset(@DbName;1):"names.nsf";"($VIMGroups)";"group1";3);
@IsMember("[Role2]"; @UserRoles);
@DbLookup("":"NoCache";@Subset(@DbName;1):"names.nsf";"($VIMGroups)";"group2";3);
"");

@If(@IsError(thisvalue);"Error";thisvalue = "";"None found";@Name([CN];thisvalue))

So if you have Role1, it is populated by group1, and Role 2 with group2

in the querysave form event I use this formula : (this is just the relevent snippet)

If st=1 Then
doc.sendto = cdoc.recipients

When I save, instead of sending I get a "Type mismatch". can anyone help or recommend another way of doing this?

I just want to send an email to the people in recipients field (which is populated based on role) based on a status field.

Many thanks!

Gonzo
 
Your problem is that cdoc.recipients is not the same value type as doc.sendto.

You can use doc.sendto to assign a value, but you cannot assign a list of values in that way, and cdoc.recipients is considered a list when you use its values in an assignment.

An easier way of doing this would be to type
doc.sendto = cdoc.recipients(0),

but then your SendTo field will only have one recipient, and you may wish to send to more than one recipient (ie your recipient list may be multi-value).

In which case, it is better to do something like this :
Call cdoc.recipients.CopyItemToDocument(doc, "SendTo" ).

Hope this helps !

Pascal.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top