Hi, I'm setting up our CRM to reflect our business needs and have created a Course Schedules module, which takes a Course from a custom course module, and allows booking it in, with a start to end date and links it too students, trainers and other relevant details through lookup feilds.
Using the start and end date, I want to automatically create either a meeting, or Calendar entry based on those dates.
I am new to deluge but have begun the following script, could someone assist with the code for what I am wanting to achieve.
courseInfo = zoho.crm.getRecordById("Courses1,1");
startDateTime = ifnull(courseInfo.get("Start_Date_Time"),"");
endDateTime = startDateTime.toDateTime("yyyy-MM-dd'T'HH:mm:ss'+08:00'").addHour(2).toString("yyyy-MM-dd'T'HH:mm:ss'+08:00'")
info endDateTime;
meetingTitle = ifnull(courseInfo.get("Course_name"));
ownerId = courseInfo.get("Owner").get("id");
lineOne = ifnull(leadInfo.get("Street"),"");
lineTwo = ifnull(leadInfo.get("Address_Line_2"),"");
city = ifnull(leadInfo.get("City"),"");
country = ifnull(leadInfo.get("Country"),"");
code = ifnull(leadInfo.get("Postcode"),"");
fullAddress = lineOne + ", " + lineTwo + ", " + city + ", " + country + " " + code;
eventmap = Map();
eventmap.put("Event_Title",meetingTitle);
eventmap.put("Owner",ownerId);
eventmap.put("What_Id",leadId);
eventmap.put("Venue",fullAddress);
eventmap.put("$se_module","Leads");
eventmap.put("Start_DateTime",startDateTime);
eventmap.put("End_DateTime",endDateTime);
recipients = list();
recipientMap = {"invited":true,"type":"email","participant":leadEmail,"status":"not_known"};
recipients.add(recipientMap);
eventmap.put("Participants",recipients);
createEvent = zoho.crm.createRecord("Events",eventmap);
info createEvent;