Service reports play a crucial role in tracking completed work, recording customer interactions, and ensuring smooth business operations. In Zoho FSM (Field Service Management), service reports contain important details about service appointments and technician activities. For a more streamlined workflow, businesses need to integrate these reports with Zoho CRM by attaching them to Deals, Accounts, or Contacts.
This article provides a step-by-step guide on fetching FSM service reports and attaching them to CRM records using Zoho's APIs. We'll walk through the implementation, including fetching service appointment details, retrieving the service report, and linking it to a deal in Zoho CRM.
Extract the id of the Service Appointment (sa_id).
Retrieve the associated Work Order ID (wo_id).
Fetch the Work Order details using the zoho.fsm.getRecordById API.
Extract the related Deal ID from the Work Order.
Make a GET API request to retrieve the service report attached to the Service Appointment.
Extract the file ID of the service report PDF.
Create a note in Zoho FSM under the corresponding Work Order using the POST API request.
Store the newly created note ID.
Prepare the attachment payload with the file ID and file name.
Use the POST API request to attach the service report PDF to the Work Order note.
Fetch the related records (Notes) for the Service Appointment.
Extract the file ID of the attached service report.
Use the GET API request to download the service report file using the extracted file ID.
Set the file type to pdf and name it appropriately.
Use the zoho.crm.attachFile function to attach the service report to the corresponding deal in Zoho CRM.
Confirm the attachment by logging the response.
Endpoint: /fsm/v1/Service_Appointments/{sa_id}/Service_Reports
Method: GET
Purpose:
Retrieve the service report linked to a service appointment.
URL: Create a Note
Endpoint: /fsm/v1/Work_Orders/{wo_id}/Notes
Method: POST
Purpose:
Add a note to the work order in FSM.
URL: Attach File to Note
Endpoint: /fsm/v1/Notes/{note_id}/Attachments
Method: POST
Purpose:
Attach a file to the created note in FSM.
URL: Download File
Endpoint: /fsm/v1/files?file_id={file_id}
Method: GET
Purpose:
Download the attached service report from FSM.
Endpoint: /crm/v6/Deals/{deal_id}/Attachments
Method: POST
Purpose:
Attach the service report to a deal in Zoho CRM.
By automating the attachment of FSM service reports to CRM records, businesses can enhance data accessibility, improve service tracking, and ensure seamless operations. This integration ensures that all service-related documents are readily available within the CRM, enabling better customer interactions and informed decision-making.