onCustomModuleCreate
When a custom module record is created, the onCustomModuleCreate event is invoked and the registered callback method is executed.
Subscribe to the event and register the callback in the app manifest under modules.custom_module.events. You can subscribe to both onCustomModuleCreate and onCustomModuleUpdate in the same app.
"custom_module": {
"events": {
"onCustomModuleCreate": {
"handler": "onCustomModuleCreateCallback"
},
"onCustomModuleUpdate": {
"handler": "onCustomModuleUpdateCallback"
}
}
}Define the corresponding callback in server.js:
exports = {
onCustomModuleCreateCallback: function(payload) {
console.log("Logging arguments from onCustomModuleCreate event: " + JSON.stringify(payload));
},
onCustomModuleUpdateCallback: function(payload) {
console.log("Logging arguments from onCustomModuleUpdate event: " + JSON.stringify(payload));
}
};Attributes of the data object
- actorobject
Information pertaining to the entity who triggered the onCustomModuleCreate event in the Freshsales Suite system.
- created_atstring
Timestamp of when the actor was created in the Freshsales Suite system, specified in the UTC format.
- deal_pipeline_idinteger
Identifier of deal pipelines that this actor is part of.
- emailstring
Email address of the actor.
- idinteger
Identifier of the actor.
- is_activeboolean
Specifies whether the actor is currently active in the Freshsales Suite system.
Possible values: true, false
- is_forgottenboolean
Specifies whether the actor has been permanently deleted from the Freshsales Suite system.
Possible values: true, false
- job_titlestring
Designation of the actor in the Freshsales Suite system.
- languagestring
Language of the actor. By default, the language is set to en.
- mobile_numberstring
Contact number of the actor.
- namestring
Name of the actor.
- time_zonestring
Time zone of the actor configured in the Freshsales Suite system.
- typestring
Identifier specifying whether a user or system created the sales account.
Possible values: user, system
- updated_atstring
Timestamp of when the actor details were last updated in the Freshsales Suite system, specified in the UTC format.
- uuidstring
Unique user identifier, which is auto-generated.
- work_numberstring
Official phone number of the actor.
- associationsobject
All associated objects of the custom module record object, which specify additional information pertaining to the custom module.
- creatorobject
Details of the custom module record creator.
- ownerobject
Details of custom module record creator.
- updaterobject
Details of the custom module record updater.
- custom_module_recordobject
Details of the custom module record object created when the onCustomModuleCreate event is triggered.
- created_atobject
Record creation timestamp.
- creator_idobject
Details of the user who created the record.
- custom_fieldsarray
Key value pairs containing the names and values of custom fields.
- idnumber
Identifier of the record.
- import_idstring
Identifier of the equivalent record in the external system from which it was imported.
- is_deletedboolean
Specifies whether the record is deleted.
Possible values: true, false
- module_nameobject
Name of the module.
- nameobject
Name in the record.
- owner_idobject
Details of the user who owns the record.
- recent_noteobject
Recently added note against the record.
- statusnumber
Status of the record.
- updated_atobject
Updated timestamp.
For onCustomModuleCreate, updated_at is the same as created_at.
- updater_idobject
Details of the user who updated the record.
onCustomModuleUpdate
When a custom module record is updated, the onCustomModuleUpdate event is invoked and the registered callback method is executed.
Subscribe to the event and register the callback in the app manifest under modules.custom_module.events. You can subscribe to both onCustomModuleCreate and onCustomModuleUpdate in the same app.
"custom_module": {
"events": {
"onCustomModuleCreate": {
"handler": "onCustomModuleCreateCallback"
},
"onCustomModuleUpdate": {
"handler": "onCustomModuleUpdateCallback"
}
}
}Define the corresponding callback in server.js:
exports = {
onCustomModuleCreateCallback: function(payload) {
console.log("Logging arguments from onCustomModuleCreate event: " + JSON.stringify(payload));
},
onCustomModuleUpdateCallback: function(payload) {
console.log("Logging arguments from onCustomModuleUpdate event: " + JSON.stringify(payload));
}
};Attributes of the data object
- actorobject
Information pertaining to the entity who triggered the onCustomModuleUpdate event in the Freshsales Suite system.
- associationsobject
All associated objects of the custom module record object (creator, owner, updater).
- changesobject
Information pertaining to the changes that triggered the onCustomModuleUpdate event, specified as a JSON object of the following format:
"changes": { "misc_changes": {}, "model_changes": { //For non-array attributes "<custom_module_record.attribute that changed>": ["Old value", "New value"] //For array attributes "<custom_module_record.array attribute that changed>": [["Old array"], ["New array"]] }, "system_changes": {} }- misc_changesobject
List of all miscellaneous database parameters whose values have changed, along with the old and modified values.
- model_changesobject
List of all attributes whose values have changed, along with the old and modified values of the attributes.
- system_changesobject
List of all system-level parameters whose values have changed, along with the old and modified values.
- custom_module_recordobject
Details of the custom module record object when the onCustomModuleUpdate event is triggered.
For onCustomModuleCreate, updated_at is the same as created_at.