Alarm Rule Custom Function

Alarm Rule Custom Function

When an Alarm Rule is configured in Zoho IoT, you define the condition under which the alarm should be raised. As part of this configuration, you can specify a custom function to run as the end action. Each time the alarm is triggered, the associated alarm rule custom function is executed.

Alarm rule custom functions must be written using the Deluge scripting language.

This document describes the steps to create one, how to associate it with an alarm rule, and an example script demonstrating its use.

Creating an Alarm Rule Custom Function

To create a command custom function,
  1. Click Add Custom Function.



  2. Select Alarm Rules in the Category field.



  3. Provide the required values in the appropriate fields.
    Example -
    Language : Deluge
    Model/Module: Home Sensor (Select the model on which the device, asset, or location is based on)
    Display Name: Create Service Order (Provide a name of your choice)
    Function Name: create_service_order (Provide a name of your choice)
    Description:  A custom function that creates a service order when a particular alarm is triggered.



  4. Click Save. This will open the Code Editor. 



  5. Provide the required code.



  6. Click Save and Close.



Alarm Rule Custom Function Code Example

Below is an example of a custom function that creates a service record using the asset for which the alarm was raised and the temperature value at the time of the alarm. The temperature threshold and the alarm condition are defined in the alarm rule, so this function is executed automatically whenever the alarm is raised.

current_time = zoho.currenttime;
postBody = Map();
moduleData = Map();
moduleData.put("Name",assetName + "_" + current_time);
moduleData.put("Temperature",temperature);
postBody.put("service_order",moduleData);
post_response = invokeurl
[
url :moduleUrl
type :POST
parameters:postBody.toText()
connection:"app-link"
];
info post_response;

NotesNote: In this custom function a connection is used for authentication. Refer to this document to learn more.

Associating with an Alarm Rule

Once the custom function is created, it becomes available during alarm rule configuration for instances of the selected model. You can associate the custom function in the Configure Actions step when creating or editing an alarm rule.

While in the configure action step,
  1. Click Add Action.



  2. Select Custom Function from the dropdown list.



  3. Select the required custom function and click Associate. For this illustration, Create Service Order is selected.



  4. You can see the custom function added as the action.



  5. Click Finish to save.

The custom function will now be associated with the selected alarm rule. 

See Also


      Create. Review. Publish.

      Write, edit, collaborate on, and publish documents to different content management platforms.

      Get Started Now


        Access your files securely from anywhere

          Zoho CRM Training Programs

          Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

          Zoho CRM Training
            Redefine the way you work
            with Zoho Workplace

              Zoho DataPrep Personalized Demo

              If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

              Zoho CRM Training

                Create, share, and deliver

                beautiful slides from anywhere.

                Get Started Now


                  Zoho Sign now offers specialized one-on-one training for both administrators and developers.

                  BOOK A SESSION







                              Quick LinksWorkflow AutomationData Collection
                              Web FormsEnterpriseOnline Data Collection Tool
                              Embeddable FormsBankingBegin Data Collection
                              Interactive FormsWorkplaceData Collection App
                              CRM FormsCustomer ServiceAccessible Forms
                              Digital FormsMarketingForms for Small Business
                              HTML FormsEducationForms for Enterprise
                              Contact FormsE-commerceForms for any business
                              Lead Generation FormsHealthcareForms for Startups
                              Wordpress FormsCustomer onboardingForms for Small Business
                              No Code FormsConstructionRSVP tool for holidays
                              Free FormsTravelFeatures for Order Forms
                              Prefill FormsNon-Profit

                              Intake FormsLegal
                              Mobile App
                              Form DesignerHR
                              Mobile Forms
                              Card FormsFoodOffline Forms
                              Assign FormsPhotographyMobile Forms Features
                              Translate FormsReal EstateKiosk in Mobile Forms
                              Electronic Forms
                              Drag & drop form builder

                              Notification Emails for FormsAlternativesSecurity & Compliance
                              Holiday FormsGoogle Forms alternative GDPR
                              Form to PDFJotform alternativeHIPAA Forms
                              Email FormsFormstack alternativeEncrypted Forms

                              Wufoo alternativeSecure Forms

                              WCAG

                                        Create. Review. Publish.

                                        Write, edit, collaborate on, and publish documents to different content management platforms.

                                        Get Started Now







                                                          You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.




                                                              Manage your brands on social media


                                                                • Desk Community Learning Series


                                                                • Digest


                                                                • Functions


                                                                • Meetups


                                                                • Kbase


                                                                • Resources


                                                                • Glossary


                                                                • Desk Marketplace


                                                                • MVP Corner


                                                                • Word of the Day


                                                                • Ask the Experts


                                                                  Zoho Sheet Resources

                                                                   

                                                                      Zoho Forms Resources


                                                                        Secure your business
                                                                        communication with Zoho Mail


                                                                        Mail on the move with
                                                                        Zoho Mail mobile application

                                                                          Stay on top of your schedule
                                                                          at all times


                                                                          Carry your calendar with you
                                                                          Anytime, anywhere




                                                                                Zoho Sign Resources

                                                                                  Sign, Paperless!

                                                                                  Sign and send business documents on the go!

                                                                                  Get Started Now




                                                                                          Zoho TeamInbox Resources





                                                                                                    Zoho DataPrep Demo

                                                                                                    Get a personalized demo or POC

                                                                                                    REGISTER NOW


                                                                                                      Design. Discuss. Deliver.

                                                                                                      Create visually engaging stories with Zoho Show.

                                                                                                      Get Started Now








                                                                                                                          • Related Articles

                                                                                                                          • Working with Alarm Rule Templates

                                                                                                                            Creating Alarm Rule Templates Alarm Rule Templates can be created in both the Developer Application and the End Application. In this document, we will follow the steps in creating Alarm Rule Templates from the Developer Application. The main steps in ...
                                                                                                                          • Working with Alarm Rules

                                                                                                                            Creating Alarm Rule Alarm Rules can be created in the End Application. In this document, we will follow the steps in creating Alarm Rules from the End Application. Prerequisites Define instance : Ensure the device, asset, or location instance is ...
                                                                                                                          • Adding and managing custom functions

                                                                                                                            Adding Custom Functions A custom function can be added for one of the below listed categories, each corresponding to a specific feature in the application. Once created, the custom function becomes available for the feature in the selected ...
                                                                                                                          • Understanding Alarm Rule Templates & Alarm Rules

                                                                                                                            Alarms in the Zoho IoT application are generated based on Alarm Rules. The Alarm Rules created for models are referred to as Alarm Rule Templates. These are prototypes attached to the model and get copied to devices, assets, or locations (instances) ...
                                                                                                                          • Adding a custom function in the developer application

                                                                                                                            A custom function can be added within the developer application for a specific model or module. You can configure the custom function to meet the specific requirements of a trigger or feature. Once created, this custom function will be available in ...
                                                                                                                            Wherever you are is as good as
                                                                                                                            your workplace

                                                                                                                              Resources

                                                                                                                              Videos

                                                                                                                              Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.



                                                                                                                              eBooks

                                                                                                                              Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.



                                                                                                                              Webinars

                                                                                                                              Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                                                                                              CRM Tips

                                                                                                                              Make the most of Zoho CRM with these useful tips.



                                                                                                                                Zoho Show Resources