Automatic Update Integer Field when send a Email

luizmarcond
Tera Contributor
Hey guys!

Basically I need there to be a Business Rule so that when I send an email from a certain table, the increment field in that table counts +1, thus updating the subject of the email.

I already have the increment fields etc, I'm having difficulty writing the code. 

How could I write this code, can anyone help me?
5 REPLIES 5

Vishal Jaswal
Giga Sage

Hello @luizmarcond 

Here is what I did:

1. Created a dummy table

2. Created a Before Business Rule (when record is inserted):

 

(function executeRule(current, previous /*null when async*/ ) {

    // Add your code here
    current.u_increment = current.u_increment + 1;

})(current, previous);

 

vishal_jaswal_2-1740682408484.png
3. Created a dummy e-mail notification whenever record is inserted or updated:

vishal_jaswal_3-1740682472728.png

4. Created a record on dummy table/form:

Before

vishal_jaswal_4-1740682518950.png



After

vishal_jaswal_5-1740682544932.png


Here is the e-mail log

vishal_jaswal_6-1740682588465.png

 


Hope that helps!