Sending Details to ERP Service

Sending Details to ERP Service


Let us consider a scenario where a customer is monitoring energy consumption in a building by implementing the Zoho IoT's Energy monitoring solution. At the start of every month, the customer wants to calculate the energy consumed in the previous month and send it to the ERP system used by the customer for billing purposes.

This implementation is achieved using the functionality Schedules and Custom Function action as the requirement is to perform the same operation every month.


Prerequisites

First, ensure that the following prerequisites including the necessary licenses, permissions, setups, and configurations are in place.
  1. Have a valid Zoho IoT account with the required licenses and authenticated ERP credentials.
  2. Ensure the user has permissions for Schedules and Custom Functions.
  3. A Zoho IoT application must be set up to monitor and manage building energy consumption.
  4. Configure an energy meter instance (e.g., Energy Meter 1) as the parent meter to consolidate data from all building assets.

Implementation   

The following outlines the high-level steps involved in the implementation.
  1. Configuring Connections - To execute the APIs call inside the custom function when it is triggered i.e. every month, configure connections as authentication for respective APIs.
  2. Creating a Schedule - To execute at start of every month and execute the associated custom function.
  3. Creating a Custom Function - To include the business logic to get the needed data and send to the ERP application.

Procedure 

The following provides a step-by-step procedure of the implementation.

 

Step 1: Configure Connections 

We will be creating two connections in the step.
  1. Connection named IoT Connection using Zoho IoT Service (if available) or Custom Service to authenticate when calling the Zoho IoT API.
  2. Connection named ERP Connection using Custom Service to authenticate the ERP APIs.

To create the Zoho IoT connection,
  1. Access the End Application. Click on the Setup icon.
  2. Click Connections under the INTEGRATIONS section.

    The below page is displayed if there are no connections configured.


Image: Sample connections home page

    Else,
    The available connections (if any) are displayed on the right.


Image: Sample connections home page with configured connections

3. Click Create Connection button at the center of the screen or at the top right corner of the screen.
NotesNote: As the scope ZohoIOT.settings.cirrus.data.READ scope that is used to fetch data from the application is not available in any default service, you need to create a Custom Service connection. Refer to the Creating Custom Services document for complete details.

4. Select the Custom Services tab.



5. In the Custom Service tab, click Create New Service.



      To create a custom connection for this implementation:
    1. Provide the service details for the connection as in the screenshot below.
    2. The Oauth details such as Client ID and Client Secret can be obtained by registering the client (application).
    3. Provide the scope as ZohoIOT.settings.cirrus.data.READ. The ZohoIOT.settings.cirrus.data.READ scope is used to fetch data from the application.
    4. Click Create Service



      Image: Sample connections configuration screen

5. The Service is created. Click Create Connection in the resultant page. 



6. Provide the Connection Name and Connection Link Name
7. Click Create and Connect.



Image: Sample connections configuration screen

9. Click Connect.


Image: Connections Connect screen

10. Once connected, the below screen will be displayed with the sample code.
11. The entries from the highlighted code below is used in the deluge custom function code.
Alert
Important: You will be using the url, type, parameter, and connection entries when writing your logic in the custom function.



Image: Deluge code


Similarly, create a second connection ERP Connection using Custom Service for accessing the ERP service securely using OAuth 2.0 or API Key. Refer to the Creating Custom Services document for complete details.

To create the ERP Service connection,

1. Select the Custom Services tab.



5. In the Custom Services tab, click Create New Service.



      To create a custom connection for this implementation:
    1. Provide the service details as in the screenshot.
    2. Click Create Service. The service ERP_Service is created. 
      


Image: Sample Custom Service creation screen for ERP Connection

                    3. In the resultant screen, click Create Connection to create a connection using the ERP_Service.




4. Provide the Connection Name and Connection Link Name.
5. Click Create and Connect. This connection allows Zoho IoT to send or receive data from the ERP system without re-entering credentials each time.



Image: Sample Custom Service creation screen

5. The Sample codes are displayed in the resultant connection screen. The highlighted code below is used in the custom function code.

Alert
Important: You need to modify the url, type, and parameter entries with your values when writing your logic in the custom function.


.
Image: Connection screen with deluge script


Step 2:  Create a Schedule

Configure a schedule to run at the start of every month. 

To create a new schedule,
  1. Access the End Application.
  2. Click on the Setup icon.
  3. Click Schedules under the AUTOMATION section. The schedules available (if any) are displayed in the right.



    Image: Schedule home page

  4. Click the Add Schedule button in the top right corner. The New Schedule addition form is displayed.
  5. Provide the name for the schedule, and provide the required details.


    Image: Sample Schedule configuration screen

  6. In Configuring Actions, click Add Action
  7. Select Custom Function. The available custom functions (if any) are displayed.
  8. Select the custom function from here, and it will be associated to the schedule.
    Else,
    If you have not yet created the custom function, Click the Custom Function button to create a new custom function for the schedule.

Step 3: Create a Custom Function

In the custom function's editor, provide code to implement the business logic to:
  1. Connect to the IoT application.
  2. Retrieve the datapoints for each energy meter in Zoho IoT.
  3. Compute the total energy consumed by summing up all readings.



Image: Sample Custom Function code in deluge editor

Important: In the sample business logic for the implementation provided below, include your own custom values. 


// =============================

DpName = "Energy";

DpSource = "Energy Meter 1";

Period = "lastmonth";

// =============================

// Step 2: Define Zoho IoT API and ERP API endpoints

// =============================

// Zoho IoT API endpoint to fetch energy readings from the Zoho IoT application

iot_api_url = "https://app15414XXXX.zohoiot.in/iot/v1/datapoints/data?datapoint_name=" + DpName + "&source=" + DpSource + "&period=" + Period;

info iot_api_url;

// (Update to actual API endpoint in your Zoho IoT setup)

// ERP API endpoint to send consumption summary

erp_api_url = "https://erp.example.com/api/energy/monthly";

// Replace with actual ERP URL

// =============================

// Step 3: Fetch device list from IoT

// =============================

// Use Zoho Connection for authentication (example connection name: 'zoho_iot_conn')

device_response = invokeurl

[

url :iot_api_url

type :GET

connection:"iotconnection"

];

info device_response;

erp_url = "https://erp.example.com/receive_data";

device_response = invokeurl

[

url :erp_url

type :POST

connection:"erp_conn"

];

info device_response;



Conclusion

This implementation showcases how Zoho IoT’s Energy Monitoring solution can automate monthly energy data processing and integration with ERP systems. By leveraging secure connections and scheduled actions, the customer ensures accurate energy consumption data is shared seamlessly for billing and analysis reducing manual effort and improving operational efficiency.

      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

                                                                                                                            • Sending Details from Zoho Creator

                                                                                                                              This sample implementation helps to understand sending data to the Zoho IoT Application from Zoho Creator with step-by-step procedures. Scenario Zylker Generators, a leading manufacturer of diesel generators, uses two connected Zoho applications ...
                                                                                                                            • Integrating Zoho IoT with External Applications

                                                                                                                              Zoho IoT enables secure data exchange between your application and other Zoho applications or third-party services. This data exchange can be performed using Zoho IoT’s built-in functionalities or through its REST APIs. All such data access occurs ...
                                                                                                                            • Editing asset model details

                                                                                                                              After an asset model is created, you can change its name and the allowed profiles for the asset. All asset operations require necessary permissions. Refer user profiles document for more details. To edit an asset model, Access the Developer ...
                                                                                                                            • Editing asset details

                                                                                                                              After an Asset is added to the application, you can edit it to change some of the details, such as Name, Description, Connected Gateway, Located at, etc. All asset operations require necessary permissions. Refer User Profiles document for more ...
                                                                                                                            • Editing Device Details

                                                                                                                              After a device is added to the application, you can edit it to change some of the details such as Name, Description, Data interval, Edge Key, etc. All Device operations require necessary permissions. Refer User Profiles document for more details. To ...
                                                                                                                              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