Schedule Custom Function

Schedule Custom Function

When a Schedule is configured in Zoho IoT, you define the action that should run automatically at a specific time or on a recurring basis. As part of this configuration, you can specify a custom function to execute whenever the schedule is triggered. Each time the schedule runs, the associated schedule custom function is executed.

Schedule custom functions must be written using the Deluge scripting language.

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

Creating an Schedule Custom Function

To create an Schedule custom function,
  1. Click Add Custom Function.



  2. Select Schedules in the Category field.



  3. Provide the required values in the appropriate fields.
    Example -
    Language : Deluge
    Display Name: Fuel Aggregate External (Provide a name of your choice)
    Function Name: fuel_aggregate_external (Provide a name of your choice)
    Description:  A custom function to aggregate the fuel consumed and send it to an external CRM Application.



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



  5. Provide the required code.



  6. Click Save and Close.


The schedule custom function is now created. You can now associate it with the required schedule. 

Schedule Custom Function Code Example

Below is an example of a scheduler custom function that aggregates the total fuel consumed by diesel generators and sends the consolidated value to an external application. The schedule is configured to run at the end of every month, ensuring that the custom function automatically performs the monthly fuel-consumption calculation and updates the external application with the finalized data operational tracking.

url1 = "https://app12345akyrw.zohoiot.com/iot/v1/datapoints/data?datapoint_name=Fuel%20Consumed &source=DG001&aggregation=sum&time_grouping=month&period=thismonth";

response1 = invokeurl

[

url :url1

type :GET

connection:"datapointcirrus"

];

url2 = "https://app12345akyrw.zohoiot.com/iot/v1/datapoints/data?datapoint_name=Fuel%20Consumed &source=DG002&aggregation=sum&time_grouping=month&period=thismonth";

response2 = invokeurl

[

url :url2

type :GET

connection:"datapoint-iot"

];

info "RESPONSE:: " + response1 + response2;

fuel_consumed_dg1 = response1.get("Fuel Consumed").get(0).get(1);

fuel_consumed_dg2 = response2.get("Fuel Consumed").get(0).get(1);

fuel_consumed_dg_all = fuel_consumed_dg1 + fuel_consumed_dg2;

info fuel_consumed_dg1;

info fuel_consumed_dg2;

info fuel_consumed_dg_all;

url3 = "https://www.zohoapis.com/creator/v2.1/data/user.zuseredu/dg-monitiring/form/Fuel_Data";

payload = Map();

dataList = List();

recordMap = Map();

recordMap.put("Fuel_Consumed","300");

dataList.add(recordMap);

payload.put("data",dataList);

response3 = invokeurl

[

url :url3

type :POST

parameters:payload.toString()

connection:"creator-iot"

];

info response3;
Notes
Note: In this custom function a connection is used for authentication. Refer to this document to learn more.

Associating with a schedule

Once the custom function is created, it becomes available for selection when configuring a schedule. You can associate the custom function in the Configure Actions field while creating or editing a schedule.

While adding/editing a schedule,
  1. Click Add Action.



  2. Select Custom Function in the context menu.



  3. Select the required custom function and click Associate.



  4. Click Create/Save.


 
The custom function will now be executed each time the schedule runs.


      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

                              TypeformWCAG


                                          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

                                                                                                                            • Workflow Custom Function

                                                                                                                              When a Workflow Rule is configured in Zoho IoT, you define the condition that determines when the rule should run. As part of this configuration, you can assign a custom function that executes whenever the workflow rule is triggered. Each time the ...
                                                                                                                            • Uplink Message Formatter Custom Function

                                                                                                                              Payloads sent by a device can be in various formats, and they must be converted into readable JSON before the application can process them. Zoho IoT allows you to decode these payloads using an uplink message formatter implemented as a custom ...
                                                                                                                            • Understanding Custom Functions

                                                                                                                              Custom functions in Zoho IoT allow you to extend the platform's capabilities. These functions are written using various programming languages and are easy to construct. With custom functions, users can move beyond the default offerings of the ...
                                                                                                                            • 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 ...
                                                                                                                            • 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 ...
                                                                                                                              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