Zoho FSM | Create an event in monday.com Calendar for a Zoho FSM Work Order

Create an event in monday.com Calendar for a Zoho FSM Work Order

Use case: Create an event in the monday.com calendar when a work order is created
 

Step 1: Create a custom function 

Add a custom function that will create an event in Monday.com calendar from a Zoho FSM work order.
  1. Navigate to Setup > Automation > Functions and click Create Function.
  2. Enter the following details and click Save:
    1. Function Name: CreateEventInMonday
    2. Module: Work Orders
  3. In the Deluge Script Editor, enter the following script:

    try
    {
     board_id = "<Your board ID>";
     //info work_order;
     evdate = "";
     Due_Date = work_order.get("Due_Date");
     if(!Due_Date.isNull() && !Due_Date.isEmpty())
     {
      evdate = Due_Date;
     }
     else
     {
      predate1 = work_order.get("Preference").get("Preferred_Date_1");
      if(!predate1.isNull() && !predate1.isEmpty())
      {
      evdate = predate1;
      }
      else
      {
      predate2 = work_order.get("Preference").get("Preferred_Date_2");
      if(!predate2.isNull() && !predate2.isEmpty())
      {
      evdate = predate2;
      }
      else
      {
      evdate = "";
      }
      }
     }
     info evdate;
     wo_name = work_order.get("Name");
     summary_name = work_order.get("Summary");
     header_data = Map();
     header_data.put("Authorization","<API Token>");
     header_data.put("Content-Type","application/json");
     Territory_name = work_order.get("Territory").get("name").toString();
     info Territory_name;
     if(evdate != "")
     {
      event = {"query":"mutation {create_item (board_id:" + board_id + "item_name: \"" + wo_name + "\", column_values: \"{\\\"date\\\":\\\"" + evdate + "\\\", \\\"text\\\":\\\"My Text\\\"}\") {id}}"};
      info event;
      response = invokeurl
      [
      url :"https://api.monday.com/v2"
      type :POST
      parameters:event
      headers:header_data
      ];
      info response;
      item_id = response.toMap().get("data").toMap().get("create_item").get("id");
      data = {"query":"mutation {change_multiple_column_values(item_id:" + item_id + ", board_id:" + board_id + ", column_values: \"{\\\"date\\\" : {\\\"date\\\" : \\\"" + evdate + "\\\", \\\"time\\\" : \\\"18:00:00\\\"}}\") {id}}"};
      info data;
      response = invokeurl
      [
      type :POST
      parameters:data
      headers:header_data
      ];
      info response;
     }
     else
     {
      sendmail
      [
      from :zoho.adminuserid
      to :zoho.adminuserid
      subject :"Event is Not created"
      message :" Date field is Mandatory for event creation"
      ]
     }
    }
    catch (e)
    {
     info e;
     sendmail
     [
      from :zoho.adminuserid
      to :zoho.adminuserid
      subject :"Event is Not created"
      message :e
     ]
    }
For this custom function to work, the support for the escape character "\" needs to be enabled in your account. Please email Creator support regarding this.

In the above code snippet, replace the following with the actual values:
 
<Your board ID> Select the board to whose calendar you want to add the event. You can find the board ID in the URL.


 
<API Token> You can find the API token under the API tab at Account > Administration > Connections.
 

Step 2: Create a workflow rule 

Create a workflow that will add an event to the Monday.com calendar whenever a work order is created in Zoho FSM.
  1. Go to Setup > Automation > Workflow Rules and click Create Workflow.
  2. Enter the following details, then click Next:
    1. Module: Work Orders
    2. Rule Name: CreateEventInMonday
    3. Description: Create an event in the Monday.com calendar when a work order is created



  3. Select the rule trigger as Created and click Next.



  4. Select the rule criteria as To all Work Orders and click Next.



  5. Click +Action and select Function.



  6. Select Existing Functions and click Next.



  7. Select the custom function created in the previous step.



  8. Click Save.


Testing the use case 

Create a work order. A date is mandatory for event creation. So, ensure that you provide either of Due Date, Preferred Date 1, or Preferred Date 2 in the work order. If all three dates are empty, the event will not be created.
 
Also, please remove the existing Date column from your board and add it again.
 

 
The event will be added to your board's calendar.
 

    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









                                      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

                                            Zoho Desk Resources

                                            • Desk Community Learning Series


                                            • Digest


                                            • Functions


                                            • Meetups


                                            • Kbase


                                            • Resources


                                            • Glossary


                                            • Desk Marketplace


                                            • MVP Corner


                                            • Word of the Day


                                              Zoho Marketing Automation

                                                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 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









                                                                                                          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