Field Actions - On update

 

Description

If you want to perform action whenever the value of a field is modified, you can write an on update script for that field. The on update script is executed after the changed data is persisted in the database.

Syntax

on update
  {
  // specify deluge code to be executed
  
  }

Example

Let us take the example of a Feedback Application form. In the below sample, whenever the status of a feedback is updated as Closed, a mail will be sent to the person who had reported it.

form  Feedback_Form
{
    displayname  =  "Feedback Form"
    
    Your_Email_Address
    (
        displayname  =  "Your Email Address"
        type  =  email
    )

    Feedback_Category
    (
        displayname  =  "Feedback Category"
        type  =  picklist
        values  =  {"Feature Request",   "Suggestion For Improvement",   "Bug Report",   "Usability"}
    )

    Comments
    (
        type  =  textarea
        
    )

    Status
    (
        type  =  picklist
        values  =  {"Open",   "In-Progress",   "Closed"}
        on update
        {
            if (input.Status  ==  "Closed")
            {
                sendmail
                (
                    From         :  zoho.adminuserid
					 To           :  input.Your_Email_Address 
                    Subject    :  "The feedback you had sent has been incorporated in zohocreator" 
                    Message  :  "The details are as below" + "Category " + input.Feedback_Category 
+ "" + "Comments " + input.Comments ) } }
) }