Search these areas:
Support Forums
Product Info

-DataWeb: What's New
-Creating an Application
-The DataWeb Designer
-Application Management
-Data Tables
-Data Tables
-Data Analysis
-Object Model
-Full-Text Search
-Domain and Email Hosting
-HotBlock Modules
-Account Management
-New Responsive UI Module

DataWeb Help
Support Forums
Script Library
Knowledge Base

Home > Support

Script Library

  Send an email based on a database event
  chubbard posted this script:
  Frequently, you will want to send an email when there is some activity on a table -- a user inserts a record, someone updates field data in a record, etc.

To use:
- go to the table in question
- click the scripts tab
- use the drop down to indicate when you want the script to run.
- this will append the appropriate function to your script
- within the braces of that function, place this code

var emailObj = new email();
emailObj.from = "";
emailObj.replyTo = ""; =;
    = "";
             emailObj.bcc = "";
             emailObj.contentType = "text/html";
   emailObj.subject = "Your entry: " + record.myField;

             emailObj.body = "Dear " + record.ownedBy + ", you added a new record on: " + record.created  ;


Note that anywhere on this email object, you can any combination of strings or fields from the record being submitted.  

You can format the body of this email by inserting line breaks within strings in the body of the email.
  on 2001-04-03 06:12:13, chubbard responded:
  It is also possible to do this using the Westside specific JavaScript extension <ws:email>.  The above example converts to:

var emailObj =

Subject:Your entry:<%=record.myField%>
<font face="verdana,arial,sans-serif" size="2">
Dear <%=record.ownedBy%>,<br><br>

You added a new record on: <%=record.created%><br><br>


The web owner.<br><br>

<a href="">
  <img src="" width="50" height="50" border="0">


Note that it is a lot easier to deal with complex formatting using this method.

Westside script extensions are covered more fully in the help at:
Affiliate | Partner | Terms of Use | Privacy Policy | Contact Us | Pricing | Bring DataWeb In-House    
DataWeb, 720 North 10th Street, A #145, Renton, Washington 98057 *425-583-5970* Fax 484-770-4706* Email Us