Jump to content
  • 0

Task to send email with multiple records



8 answers to this question

Recommended Posts

  • 1

Caspio Bridge 21.0 release brought a Tasks\Trigger enhancement which solve this case without complex Trigger\Tasks.

There is a new block added to Triggered Action called "Table variable" which forms a table.


You can insert table variable into email body and it will be formed link a table (HTML format enabled):


Hope it helps someone.


Link to comment
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.



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.


Link to comment
Share on other sites

  • 0



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]'
), 1, 1, '')


Link to comment
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.

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.

  • Create New...