I've created a custom function whereby a Date/Time field is entered into a Lead as part of a blueprint/workflow, and then an event is created for the entered time.
The function itself works fine, however the event that is created is always 7 hours ahead of the date/time that was entered. My first thought was that this must be an issue with the timezone that the event is created in, so I tried specifying the timezone as part of the custom function based on the users location, but it seems to have had no affect.
void create_event (date interview_date, string interview_location, string lead_firstname, string lead_surname, int lead_ownerID, int lead_ID, string user_state ) Edit Arguments
if ( (input.user_state == "WA") )
{
interviewdate_timezone = input.interview_date.toString("yyyy-MM-dd hh:mm:ss a", "Australia/West") ;
interviewdate_end = (addHour(input.interview_date,1)).toString("yyyy-MM-dd hh:mm:ss a", "Australia/West") ;
}
else if((input.user_state == "VIC"))
{
interviewdate_timezone = input.interview_date.toString("yyyy-MM-dd hh:mm:ss a", "Australia/Victoria") ;
interviewdate_end = (addHour(input.interview_date,1)).toString("yyyy-MM-dd hh:mm:ss a", "Australia/Victoria") ;
}
else if((input.user_state == "NSW"))
{
interviewdate_timezone = input.interview_date.toString("yyyy-MM-dd hh:mm:ss a", "Australia/NSW") ;
interviewdate_end = (addHour(input.interview_date,1)).toString("yyyy-MM-dd hh:mm:ss a", "Australia/NSW") ;
}
else if((input.user_state == "QLD"))
{
interviewdate_timezone = input.interview_date.toString("yyyy-MM-dd hh:mm:ss a", "Australia/Queensland") ;
interviewdate_end = (addHour(input.interview_date,1)).toString("yyyy-MM-dd hh:mm:ss a", "Australia/Queensland") ;
}
else if((input.user_state == "TAS"))
{
interviewdate_timezone = input.interview_date.toString("yyyy-MM-dd hh:mm:ss a", "Australia/Tasmania") ;
interviewdate_end = (addHour(input.interview_date,1)).toString("yyyy-MM-dd hh:mm:ss a", "Australia/Tasmania") ;
}
else if((input.user_state == "SA"))
{
interviewdate_timezone = input.interview_date.toString("yyyy-MM-dd hh:mm:ss a", "Australia/South") ;
interviewdate_end = (addHour(input.interview_date,1)).toString("yyyy-MM-dd hh:mm:ss a", "Australia/South") ;
}
else if((input.user_state == "ACT"))
{
interviewdate_timezone = input.interview_date.toString("yyyy-MM-dd hh:mm:ss a", "ACT") ;
interviewdate_end = (addHour(input.interview_date,1)).toString("yyyy-MM-dd hh:mm:ss a", "ACT") ;
}
else if((input.user_state == "NT"))
{
interviewdate_timezone = input.interview_date.toString("yyyy-MM-dd hh:mm:ss a", "Australia/North") ;
interviewdate_end = (addHour(input.interview_date,1)).toString("yyyy-MM-dd hh:mm:ss a", "Australia/North") ;
}
eventMap = map() ;
eventMap.put("Subject","Initial Interview " + input.lead_firstname + " " + input.lead_surname);
eventMap.put("SMOWNERID",input.lead_ownerID);
eventMap.put("Start DateTime",interviewdate_timezone);
eventMap.put("End DateTime",interviewdate_end);
eventMap.put("Venue",input.interview_location);
eventMap.put("SEID",input.lead_ID);
eventMap.put("SEMODULE","Leads");
createEvent = zoho.crm.create("Events" ,eventMap ) ;
Info createEvent;