Video Screencast Help

Get email address from SQL and send email

Created: 10 Apr 2013 • Updated: 15 Apr 2013 | 4 comments
This issue has been solved. See solution.

I am using a SQL integrator which gives me data in format: user name, user email and has 10 rows.

I need to iterate thru this SQL output and send emails individually to the above 10 users.

For ouput I am expecting that workflow will send email to user1 from row1 then move to row2 and send email to user2 from row2 and so on..

I am using "For each element in collection" componnet. >> is this the correct component to iterate SQL table row by row?

 

Operating Systems:

Comments 4 CommentsJump to latest comment

reecardo's picture

Yes, the For Each Element In Collection is the correct component to integarte through the collection. The datatype will be whatever type the SQL output is, and the name of the collection is asically going to be your SQL output name.

If you're unsure of what the types may be, you can right-click on the For Each Element component and select Browse Data (see attached screenshot). This will show all current data on the stream at that point. If you hover over each item, you'll see the datatype.

Hope this helps.

Untitled.png
Chaitali's picture

Thanks, Reecardo. Your screenshot was very helpful!

I am taking the output from this each element component and giving it to the "send email" component.

While running the workflow, I am getting error:

The requested name is valid but no data of the requested type was found - at the send email component.

I want to send emails to all users listed in the sql table, one after another.

Have you encountered the above error message?

Please see the detailed screenshot of my workflow attached:

 

 

 

Sendmail.png
reecardo's picture

It could be that your result set from the generated component is empty/null. I'd check if the result count > 0 before entering the For each component.

HarrisT's picture

I joined a webex with Chaitali. The problem was with the custom integration component. It was initially created looking at a different database and/or table and was expecting 5 output values. The new SQL query is only returning a single column, but the component's output was never updated so it threw an exception because it could only find 1 value to output.

Updating the integration component resolved the issue.

SOLUTION