enableLogging = false; // set to true for debug logging dumpLogFileName = "_ptCalendar_inc-post-save-form-hook.html"; errorLogFileName = "_ptCalendar_inc-post-save-form-hook-error.html"; if ( enableLogging ) { try { application.ADF.log.logAppend(msg=attributes, label='attributes post save form hook', logfile=dumpLogFileName); } catch ( any expt ) { WriteDump(expt); } } // set to true to rebuild the FormName/FormID memory cache resetFormIdMap = false; try { // Init POST-save-form-hook vars elemtID = ''; dataPageID = 0; objType = ""; newRecord = false; if( StructKeyExists(attributes,'inputStruct') ) { // Set the Element ID if ( StructKeyExists(attributes.inputStruct, 'controlTypeID') ) elemtID = attributes.inputStruct.controlTypeID; else if ( StructKeyExists(attributes.inputStruct, 'FormID') ) elemtID = attributes.inputStruct.FormID; // Set the dataPageID for the current record if ( StructKeyExists(attributes.inputStruct, 'dataPageID') ) dataPageID = attributes.inputStruct.dataPageID; else if( StructKeyExists(attributes.inputStruct, 'savePageID') ) dataPageID = attributes.inputStruct.savePageID; else if( StructKeyExists(attributes.inputStruct, 'PageID') ) dataPageID = attributes.inputStruct.pageid; else dataPageID = 0; // Set the NewRecord flag if ( StructKeyExists(attributes.inputStruct,'newData') ) newRecord = attributes.inputStruct.newData; outputStruct = Duplicate( attributes.inputStruct ); if ( IsNumeric(elemtID) ) { // Calendar Event Details ceFormName = 'Calendar Event Details'; ceFormID = application.ADF.cedata.getFormIDByCEName(CEName=ceFormName); if ( elemtID EQ ceFormID ) { processType = 'update'; if ( IsBoolean(newRecord) AND newRecord EQ true ) processType = 'add'; idFldName = 'uniqueID'; idFldId = application.ADF.fields.getCEFieldId(ceNameOrID=elemtID,fieldName=idFldName); idFIC = 'FIC_#elemtID#_#idFldId#'; idValue = ''; if ( StructKeyExists(outputStruct,idFIC) ) idValue = outputStruct[idFIC]; if (TRIM(idValue) NEQ '' ) result = application.ptCalendar.calEventsCacheController.processEventCacheByEventID(eventID=idValue,process=processType); //process: add,update,delete } // Check if the current elemtID is a ptCalendar GCE... if so handle it (moved this process to a common module) // cfmodule(template="inc-hook-common.cfm",elemtID=elemtID,resetFormIdMap=resetFormIdMap); } else { // ELSE - so if no elemtID (FormID or ControlTypeID) is passed in then we are working with Metadata forms/fields // // METADATA FORMS // ----------------------------------------------------------------------------------------------------------- // Make sure we have a dataPageID which is actually the CSPageID since we will be working with a metadata form if ( dataPageID GT 0 ) { // Actions for Custom Metadata Forms here // -------------------------------------------- } // END - dataPageID check logic } // END - elemtID check logic } // END - attributes.inputStruct check logic } catch (any excpt) { application.ADF.log.logAppend(msg=excpt, label='ptCalendar-Post-Save-Error', logfile=errorLogFileName); rethrow; }