Getemailaddresses with selectsql
Hi all,
In the to Property of SendMail activity I'd like to get emailaddress for a list of users assigned to a specific role...
something like:
GetEmailAddresses(SelectSql(null,"select eusername from eassignment where erolename in ('myrole')").List)
I've double checked and all users in that role have a valid email, but I get always:
"(CLOB) Exception 'The specified string is not in the form required for an e-mail address.' occurred when attempting to 'Run script'.
The specified string is not in the form required for an e-mail address."
What's wrong?
Thanks in adv.
Andrea
Comments
-
What is the result you are getting when you retrieve the list into a memo or text field by using a button script instead of using the SendMail acitvity.
GetEmailAddresses(SelectSql(null,"select eusername from eassignment where erolename in ('myrole')").List)
Does this all look OK?
0 -
Hi Andrea
GetEmailAddresses returns a List but SendEmail requires the email addresses to be a semi colon separated string.
This should convert the List to a string for you:
string.Join(";",Mstm.GetEmailAddresses(SelectSql(null,"select eusername from eassignment where erolename in ('myrole')").List).Select(o=>o.ToString()).ToArray())
Hope that helps
iain
0 -
Hi Iain,
thanks for the explanation.
Unfortunately in the statement there is an error, I tried to make some change with no success, can you help me?
0 -
Hi Andrea
I can't see the attachment in your reply above... can you repost it?
What version are you running? (The above example is working ok for me in 9.1.1).
An alternative to the above is the following:
string.Join(";",Array.ConvertAll<object, string>(Mstm.GetEmailAddresses(SelectSql(null,"select eusername from eassignment where erolename in ('myrole')").List), Convert.ToString))
Thanks
Iain
0 -
Great! This works fine!
The error was
) expected ; expected Invalid expression term ',' ; expected ; expected invalid expression term ')' ; expected Invalid expression
We're running on 9.1.2
Many Thanks
Andrea
0
Categories
- All Categories
- 123 Developer Announcements
- 54 Articles
- 152 General Questions
- 148 Thrust Services
- 57 Developer Hackathon
- 37 Thrust Studio
- 20.6K Analytics
- 4.2K AppWorks
- 9K Extended ECM
- 918 Core Messaging
- 84 Digital Asset Management
- 9.4K Documentum
- 32 eDOCS
- 190 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management
- 10 XM Fax
- Follow Categories