Jump to content
  • 0
matstein

Task to send email with multiple records

Question

Is there any way to have a task send multiple records in one email if the records have a field that meet the certain criteria?

Currently it sends one email per record, I would one email with all the records that meet the task criteria is possible.

 

Thank you in advance!

Share this post


Link to post
Share on other sites

7 answers to this question

Recommended Posts

  • 0

Thanks for the response, I actually would like to send multiple records inside the body of the email.

 

Example..


 

Quote

 

The following items are marked shipped..

Record1

Record2

Record3

 

Thanks 

 

 

Share this post


Link to post
Share on other sites
  • 0

With the recent Caspio Release 20, the features Variables and Loops on Triggers and Tasks should make this possible.

 

This workflow is pretty advanced, the following are pre-requisites:

1.) Auxiliary (aux) table

2.) An Autonumber field in the table you would be selecting against. (Timestamps would also do, if they can be unique. But let's stick with autonumber. It's much simpler.)

 

Below is a Trigger demonstrating this implementation.

 

On an aux table, create an OnInsert Trigger, that:

1.) Instatiates variables: a. init (min autonumber), b. len (max autonumber),  c.) ConcatText (placeholder of the concatenated Email text), d. counter (optional. To count the number of records involved)

2.) Loops through the TABLE we are selecting against, whilst concatenating the involved records. The WHILE loop does magic tricks to select the next lowest autonumber per iteration.

3.) Optional. Update the #inserted.EmailContent with the ConcatText

4.) Actually send the email.

image.thumb.png.f50767ea2e76e7699bb3bfbc34f24726.png

 

This works well on my end. *Except for the counter part. Haha. I just added that last minute. I'm too occupied in making this post comprehensible. Sorry for my bad English. Kidding aside, the EmailContent works well on my end*.

 

=====

 

You can extend this trigger, perhaps, by:

1.) Adding WHERE clause to limit your DataSets

2.) Create a TASK to insert to this Aux table, therefore effectively creating reminders to your end-users.

 

I hope this helps.

DN31337

Share this post


Link to post
Share on other sites
  • 0

Hi,

Quote

the features Variables and Loops on Triggers and Task

The suggested method is not available yet.

Here is another way to accomplish it.

Create a calculated field with something like below and have this as part of the email body.

SELECT snv_id = 'Not updating your browser already resulted in the following records being submitted with missing info:' + char(10) + STUFF((
SELECT ', ' + snv_id + ' ' + CONVERT(VARCHAR(10), Visit_Date, 101) + ' ' + Client_Last_Name + ' ' + ' ' + Client_First_name + char(10) 
FROM _v_v_VisitNotes_Browser
where _v_v_VisitNotes_Browser.nurse_User_ID_num_SNV= '[@authfield:Nurse_UserName]'
FOR XML PATH('')
), 1, 1, '')

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...