Triggers are configured to invoke function blocks when specific events occur in the application or Zoho service. For example, you can trigger a welcome email to a user when your extension is installed. The mail notification function is configured in the trigger called extension-install so that the user receives your welcome mail when they install your extension. These events are broadly categorized into: extension life cycle events, service specific events, and user created custom events. You can view the list of default events from Trigger Events.
Extension life cycle events
These events are directly associated with the extension. You can create a trigger for an extension installed event or based on any other extension event.
extension_on_run
This event is triggered when you click Run to test your extension.
extension_on_stop
This event is triggered when you disable development mode to run your extension.
extension_installed
This event is triggered when you install an extension.
For instance, You can trigger a function to execute a webhook that connects the third party app (Zendesk). Write a function to configure a webhook and use this event to execute that trigger automatically whenever a user installs your extension.
extension_uninstalled
This event is triggered whenever your extension is uninstalled. Use this trigger to remove the configuration or pre-setup activities done during set up in target applications.
extension_disabled
This event is triggered whenever your extension is disabled.
extension_enabled
This event is triggered whenever your extension is enabled.
extension_updated
This event is triggered whenever your extension is updated. For example, consider you want to install a set of security packs whenever your extension is enabled. Build a function for security updates and name it as DoSecurityUpdate. Create a trigger for extension_updated event and associate the function with this trigger event.
extension_upgraded
This event is triggered when a user upgrades to a paid version of your extension.
Service events
These events are specific to the service that you make use of. For example, if you are creating extensions for Zoho Projects then following are some service specific events: create_bug, delete_bug, update_task etc. You can write functions for specific events as per your business needs and trigger the events when required. Service specific events are fixed and it varies based on the service which you make use of to create extensions.
Custom Events
Users can add new events to be associated with triggers in Sigma. Once a user creates a new custom event, it will be submitted to Sigma for validation. Only after successful validation, the event can be invoked using triggers.
Add trigger to your function
- Navigate to Extension module and hover over your extension and click .
- Navigate to Triggers and click Add Trigger.
- Enter a name for your trigger select the event at which you want the trigger to be fired.
- Associate a function to your trigger.
- Choose the corresponding version.
- Click Create.
Add custom events
Say you don’t want to use the predefined events, then use custom events to trigger your function.
- Navigate to Extension module and hover over your extension and click .
- Navigate to Triggers and click Add Trigger.
- Enter a name for your trigger.
- Click Add custom event and enter a name for your trigger.
- Associate a function to your trigger.
- Select the corresponding version to be associated.
- Click Create.