service_appointment_id = service_appointment.get("id"); resp = zoho.fsm.getRecordById("Service_Appointments",service_appointment_id); resp_data = resp.get("data").toMap(); Scheduled_End_Date_Time = resp_data.get("Scheduled_End_Date_Time"); Scheduled_Start_Date_Time = resp_data.get("Scheduled_Start_Date_Time"); Summary = resp_data.get("Summary") + " (Zoho FSM)"; description = "https://fsm.zoho.com/home#/tab/Service_Appointments/" + service_appointment_id; Service_Address_Map = resp_data.get("Service_Address").toMap(); street = Service_Address_Map.get("Service_Street_1"); city = Service_Address_Map.get("Service_City"); state = Service_Address_Map.get("Service_State"); zip = Service_Address_Map.get("Service_Zip_Code"); country = Service_Address_Map.get("Service_Country"); location = street + ", " + city + ", " + state + " " + zip + ", " + country; Contact_Id = resp_data.get("Contact").toMap().get("id"); Contact_resp = zoho.fsm.getRecordById("Contacts",Contact_Id); Contact_resp_data = Contact_resp.get("data").toMap(); con_email = Contact_resp_data.get("Email"); emailMap = Map(); emailMap.put("email",con_email); emailList = list(); emailList.add(emailMap); startMap = Map(); startMap.put("dateTime",Scheduled_Start_Date_Time); endMap = Map(); endMap.put("dateTime",Scheduled_End_Date_Time); bodyMap = Map(); bodyMap.put("end",endMap); bodyMap.put("start",startMap); bodyMap.put("description",description); bodyMap.put("eventType","default"); bodyMap.put("summary",Summary); bodyMap.put("attendees",emailList); bodyMap.put("location",location); response = invokeurl [ url :"https://www.googleapis.com/calendar/v3/calendars/{calendarId}/events" type :POST parameters:bodyMap.toString() connection:"googlecalendar" ]; info response; |