More than one entry in mailto field causing @setfield to run twice?

@SetField("$hiddenjournal";$hiddenjournal+@NewLine+"["+@Text(@Now;"D0")+ "] "+@Name([CN]; @V3UserName)+" sent the following Notification to "+@Name([CN];$hiddenmailto)+@NewLine+$hiddendeletionrequest)


This part of my code below is getting run multiple times if there are multiple names set in the $hiddenmailto field.
Is there anyway I can put the $hiddenmailto into this @setfield formula without it doing this?

Thanks scribla.
@SetField("$hiddenmailto";"");
@SetField("$hiddenmailto";@PickList( [Name] ));
@SetField("$hiddendeletionrequest"; "");
@SetField($hiddendeletionrequest;@DialogBox("NotifyForm";[AutoHorzFit]:[AutoVertFit]:[OkCancelAtBottom]; "Message/Reason for Notification"));

@If($hiddendeletionrequest="";@Prompt([Ok]; "Notification cancelled"; "Your message cannot be empty");

@MailSend($hiddenmailto;@If(@Prompt([YesNo]; "CC?"; "Would you like to be copied in on this notification?" );@UserName;"");"";@Text("EEB Notification: ")+@Text(EnquiryNumber)+" "+@Text(Clientname);



"Hi "+@NewLine+@NewLine+"You have been sent this Electronic Enquiry Book notification by "+@Text(@Name([CN];@UserName))+" regarding enquiry "+@Text(enquirynumber)+" "+@Text(clientname)+" - "+@Text(scopeofwork)+@NewLine+@NewLine+@Text(@Left(@Name([CN];@UserName);" "))+"'s message: "+@NewLine+@Text($hiddendeletionrequest)+@NewLine+@NewLine+"You can review this enquiry record by clicking the doclink icon below.";"";[IncludeDoclink]);

@Prompt([Ok]; "Success"; @Text("Notification sent to selected recipient(s)")); @Command([FileCloseWindow]))



;@If($CopyNotificationToJournal="Record the notification details in the enquiry journal";

@SetField("$hiddenjournal";$hiddenjournal+@NewLine+"["+@Text(@Now;"D0")+ "] "+@Name([CN]; @V3UserName)+" sent the following Notification to "+@Name([CN];$hiddenmailto)+@NewLine+$hiddendeletionrequest);@IsValid)

;@IsValid

Open in new window

LVL 2
scriblaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sjef BosmanGroupware ConsultantCommented:
No, the @SetField isn't executed twice, but the string that you generate is twice as long. An implicit @Implode is executed (kind of), so what you have to do is make it explicit.

Suggestion:

@SetField("$hiddenjournal";$hiddenjournal+@NewLine+"["+@Text(@Now;"D0")+ "] "+@Name([CN]; @V3UserName)+" sent the following Notification to "+ @Implode(@Name([CN];$hiddenmailto); ",")+@NewLine+$hiddendeletionrequest)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
scriblaAuthor Commented:
Fantastic. Many thanks Sjef!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.