var eventStruct = Application.ptCalendar2.calendarDAO.getCalendarEventByUniqueID(TRIM(arguments.eventID));
var catNameList = "";
var i = 1;
var catUserIDList = "";
var catUserEmailList = "";
var emailSendStatus = false;
var noticationStatusStruct = StructNew();
// Get the Data for the record passed in.
if ( structKeyExists(eventStruct.values,"uniqueID") AND LEN(TRIM(eventStruct.values.uniqueID)) )
catNameList = eventStruct.values.category;
// Get List of UserIDs from the provided list of Categories
if ( LEN(TRIM(catNameList)) )
catUserIDList = Application.ptCalendar2.eventCategoryDAO.getCategoryUserList(catNameList);
// Get List of User's' Email Addresses from list of UserIDs
if ( LEN(TRIM(catUserIDList)) )
catUserEmailList = Application.ptCalendar2.csUsersDAO.getUserEmailListByIDList(catUserIDList);
// Build and Send Email to Notification Users
if ( LEN(TRIM(catUserEmailList)) )
emailSendStatus = sendEventNotifcationEmail(catUserEmailList,eventStruct);
noticationStatusStruct["EmailSendStatus"] = emailSendStatus;
noticationStatusStruct["EmailAddressList"] = catUserEmailList;
noticationStatusStruct["EventCategories"] = catNameList;
noticationStatusStruct["EventID"] = arguments.EventID;
return noticationStatusStruct;
var emailMessage = "";
var emailSubject = "Event Notification";
var emailFromAddress = "test@test.com";
var sentSuccess = false;
var calAppConfig = getAppConfig();
var eventStruct = arguments.eventDetailsStruct;
// Get App Config Settings
if ( structKeyExists(calAppConfig,'Event_Notification_From_Address') AND LEN(TRIM(calAppConfig['Event_Notification_From_Address'])) )
emailFromAddress = calAppConfig['Event_Notification_From_Address'];
if ( structKeyExists(calAppConfig,'Event_Notification_Email_Subject') AND LEN(TRIM(calAppConfig['Event_Notification_Email_Subject'])) )
emailSubject = calAppConfig['Event_Notification_Email_Subject'];
if ( structKeyExists(calAppConfig,'Event_Notification_Email_Message') AND LEN(TRIM(calAppConfig['Event_Notification_Email_Message'])) )
emailMessage = calAppConfig['Event_Notification_Email_Message'];
if ( LEN(TRIM(emailMessage)) )
emailMessage = REPLACENOCASE(emailMessage,"[EventCats]",eventStruct.values.category,"all");
[#UCASE(request.site.name)#] #TRIM(emailSubject)##CHR(10)#
#emailMessage#
Event Details:
Organizations: #eventStruct.values.Organization#
Categories: #eventStruct.values.category#
Event Title: #eventStruct.values.Title#
Event Date: #DateFormat(eventStruct.values.eventDate,"mm/dd/yyyy")#
Start Time: #TimeFormat(eventStruct.values.starttime,"h:mm tt")#
Location: #eventStruct.values.location#
No event details available or an error occured!
#emailMessage#