try { file_list = list(); Appointment_id = service_appointment.get("id"); contactId = service_appointment.get("Contact").get("id"); contactResp = zoho.fsm.getRecordById("Contacts",contactId); email = contactResp.get("data").toMap().get("Email"); info email; related_resp = invokeurl [ url :"https://fsm.zoho.com/fsm/v1/Service_Appointments/" + Appointment_id + "/Job_Sheets" type :GET connection:"zfsm" ]; if(!related_resp.isNull() && !related_resp.isEmpty()) { jobsheetResp = related_resp.get("data"); if(jobsheetResp.isNull() || jobsheetResp.isEmpty()) { info "No jobsheets present in the SA !!!"; } else { jobsheet_list = related_resp.get("data").toList(); for each jobsheet in jobsheet_list { Status = jobsheet.get("Status"); if(Status.equalsIgnoreCase("Completed")) { filename = jobsheet.get("Name"); file_id = jobsheet.get("id"); if(!file_id.isNull() && !file_id.isEmpty()) { fileResp = invokeurl [ url :"https://fsm.zoho.com/fsm/v1/Job_Sheets/" + file_id + "/actions/download?type=pdf" type :GET connection:"zfsm" ]; filename = filename + ".pdf"; fileResp.setFileType("pdf"); fileResp.setFileName(filename); file_list.add(fileResp); } } } } } if(!file_list.isEmpty()) { sendmail [ from :zoho.adminuserid to :email subject :"Jobsheets " message :"PFA" Attachments :file:file_list ] } } catch (err) { info err; sendmail [ from :zoho.adminuserid to :zoho.adminuserid subject :"Error in executing the code" message :err ] } |
Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.
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.
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.