Create a Scheduled Maintenance

Purpose

To create a new scheduled maintenance record.

Request URL

https://fsm.zoho.com/fsm/v1/Scheduled_Maintenances

Request Method

POST

Scope

scope=ZohoFSM.modules.ScheduledMaintenances.CREATE

Input JSON Keys

NameDescriptionType
Name
(mandatory)
The name for the scheduled maintenanceString
Schedule
(mandatory)

The schedule details. The possible values of the JSON keys are:

 

- Frequency: Daily, Weekly, Monthly, or Yearly

 

- Interval

1 to 6 - Use these for Every Day, Every 2 Days,....., Every 6 Days, Every Week, Every 2 Weeks,.., Every 5 Weeks, Every Month, Every 2 Months,..., Every 6 Months.

1, 0.5, 0.25 - Use these for Yearly Once (Annually), Yearly Twice (Biannually), Yearly 4 times (Quarterly)

 

- By_Days: 1 to 7

 

This key corresponds to the values Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday that you will choose for the Weekly frequency

 

- By_Dates: 1 to 31

 

This key corresponds to On Each for the Monthly frequency. You can provide a maximum of five values. Example: "By_Dates": "1,2,3"

This key corresponds to On The for the Yearly frequency.

 

- By_Week: First, Second,....., Fifth, Last

 

This key corresponds to On The for the Monthly, Yearly frequency. 

 

- By_Day:

 

Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Day

This key corresponds to On The for the Monthly, Yearly frequency.

- By_Month: 1 to 12
This key corresponds to Start Month for the Yearly frequency.

JSON Object

Batch
(mandatory)

The batch details. The possible values of the JSON keys are:

 

- Batch_Type: SAME_DAY, WEEK_START, MONTH_START, DAYS_BEFORE

 

- Batch_Interval: Any number

Use this if DAYS_BEFORE is chosen for Batch_Type

 

JSON Object
Start_Date
(mandatory)
The date on or after which you want the records to be created for the maintenance plan.Date
EndsUse this to specify the criteria for when you want the record creation for the maintenance plan to end. The possible values of the JSON keys are:

- End_Type: On, After

- Ends_On: Specify the date on which you want the record creation for the maintenance plan to end. 
Provide this value if you choose On for End_Type.

- Ends_After: Any number. 
Provide this value if you choose After for End_Type.

- Ends_After_By: Batch, Schedule. 
Provide this value if you choose After for End_Type.
 
JSON Object
$work_order_template

Use this to add the work order template. The mandatory fields are the same as those for a work order record.

If a scheduled maintenance plan is created without a work order template, then by default, it will be in inactive state.

JSON Object
$appointment_templateUse this to add the service appointment template. The mandatory fields are the same as those for a service appointment record.

Use the Status key to un/check the Dispatch Appointment checkbox. If you want to select the Dispatch Appointment checkbox, set the value of Status to Dispatched. If you want to leave the Dispatch Appointment checkbox unselected, set the value of Status to Scheduled or leave it blank. Please refer to this page for details on the Dispatch Appointment checkbox.
JSON Object

Sample Request

Copiedcurl --request POST 'https://fsm.zoho.com/fsm/v1/Scheduled_Maintenances' \
--header 'Authorization: Zoho-oauthtoken 1000.26xxxxxxxxxx.xxxxxxxxxx0' \
--header 'content-type: application/json' \
--data "@sm.json"

Sample Input

Copied{
    "data": [
        {
            "Name": "Landscaping services for Acme Pvt. Ltd.",
            "Description": null,
            "Schedule": {
                "Frequency": "Monthly",
                "Interval": "2",
                "By_Dates": null,
                "By_Day": "Monday",
                "By_Week": "First",
                "By_Days": null
            },
            "Batch": {
                "Batch_Type": "DAYS_BEFORE",
                "Batch_Interval": 1
            },
            "Start_Date":"2024-02-27",
            "Ends":{
                "End_Type": "After",
                "Ends_After": 10,
                "Ends_After_By": "Batch"
            },
            "$work_order_template": {
                "Summary": "Landscaping services for Acme Pvt. Ltd.",
                "Priority": null,
                "Type": "Service",
                "Company": {
                    "id": "6191000000232001"
                },
                "Contact": {
                    "id": "6191000000232009"
                },
                "Email": "gregory@noemail.com",
                "Phone": "111-111-11111",
                "Mobile": null,
                "Asset": null,
                "Territory": {
                    "id": "6191000000227288"
                },
                "Service_Address": {
                    "id": "6191000000232018"
                },
                "Billing_Address": {
                    "id": "6191000000232017"
                },
                "Preference": {
                    "Preferred_Time": null,
                    "Preference_Note": null
                },
                "Discount": 0,
                "Discount_Type": "Currency",
                "Adjustment": 0,
                "Service_Line_Items": [
                    {
                        "Service": {
                            "id": "6191000000232031"
                        },
                        "Description": null,
                        "Quantity": 1,
                        "Unit": null,
                        "List_Price": 12,
                        "Amount": 12,
                        "Sequence": 1,
                        "Line_Item_Amount": 12,
                        "Status": "New",
                        "Contact": {
                            "id": "6191000000232009"
                        },
                        "Skill_Line_Items": [],
                        "Part_Line_Items": [],
                        "Service_Tasks_Line_Items": []
                    }
                ]
            },
            "$appointment_template": {
                "Summary": "Landscaping services for Acme Pvt. Ltd.",
                "Contact": {
                    "id": "6191000000232009"
                },
                "Company": {
                    "id": "6191000000232001"
                },
                "Asset": null,
                "Email": null,
                "Phone": null,
                "Mobile": null,
                "Scheduled_Start_Date_Time": {
                    "relativeDateTime": "10:00 AM",
                    "relativeDateType": "SAME_DAY"
                },
                "Scheduled_End_Date_Time": {
                    "relativeDateInterval": 1,
                    "relativeDateTime": "10:00 AM",
                    "relativeDateType": "DAYS_AFTER"
                },
                "Service_Line_Items": [],
                "Status": "Dispatched",
                "$Service_Resources": [
                "6191000000227293",
                "6191000000299016"
                ],
                "Lead": "6191000000299016"
            }
        }
    ]
}

Sample Response

Copied{
    "result": "success",
    "code": "SUCCESS",
    "data": {
        "Scheduled_Maintenances": [
            {
                "UID": "Scheduled_Maintenances_0",
                "Modified_Time": "2024-02-27T17:30:55+05:30",
                "Modified_By": {
                    "name": "Alicia Florrick",
                    "id": "6191000000227001"
                },
                "Created_Time": "2024-02-27T17:30:55+05:30",
                "id": "6191000000436062",
                "Created_By": {
                    "name": "Alicia Florrick",
                    "id": "6191000000227001"
                },
                "TabName": "ScheduledMaintenances"
            }
        ]
    },
    "status": "success"
}