Custom Actions
Custom Actions is a component within an extension. So, you’ll have to create an extension in Sigma and create a widget before you can configure the custom action. Once configured, you can publish it as an extension privately. Next, you can install the Custom Actions extension in your Zoho products organization, and it will be listed under the default Workflow Actions in Zoho products settings. Here, you can create new actions that can be associated with a workflow rule, and the action will be executed when the workflow rule’s conditions are met.
- Methods
- Events
Methods
Get Customaction
The get method of the customaction module allows you to retrieve details of a specific custom action configured in your Zoho Products organization. You can use this method to fetch information such as the name, description, input parameters, entity type, and associated entities of the custom action. This is particularly useful when you want to display or utilize the custom action's details within your widget or extension.
ZFAPPS.get('customaction')
.then(data => console.log('customaction:', data))
.catch(err => console.error('Error:', err));
| Property | Request |
|---|---|
| name | name |
| description | description |
| customaction_input | customaction_input |
| entity_type | entity_type |
| entities | entities |
Set Customaction
The set method of the customaction module allows you to create or update a custom action in your Zoho Products organization. You can use this method to define the properties of the custom action, such as its name, description, input parameters, and associated entity type. This is particularly useful when you want to programmatically manage custom actions within your widget or extension, enabling you to automate workflows and enhance the functionality of your Zoho Products environment.
let customActionInputData = {};
customActionInputData['message'] = document.getElementById('message').value;
customActionInputData['subject'] = document.getElementById('subject').value;
customActionInputData['toAddress'] = document.getElementById('address').value;
let updateCustomActionData = {
'name' : document.getElementById('name').value,
'entity_type' : document.getElementById('entity').value,
'description' : document.getElementId('descp').value,
'customaction_input' : JSON.stringify(customActionInputData)
};
ZFAPPS.set('customaction', updateCustomActionData)
| Property | Request |
|---|---|
| name | name |
| description | description |
| customaction_input | customaction_input |
| entity_type | entity_type |
This set method only work for 'ON_CUSTOMACTION_PRE_SAVE' event inside.
Events
ON_CUSTOMACTION_PRE_SAVE
This event is triggered just before the customaction record is saved in your organization. It allows your widget to validate data, modify field values, or perform custom checks before the save operation is completed.
ZFAPPS.extension.init().then(Zapp) => {
Zapp.instance.on('ON_CUSTOMACTION_PRE_SAVE', async(data) => {
let updateCustomActioData = {
name : document.getElementById(name).value,
entity_type : document.getElementById(entity).value,
description : document.getElementId(descp).value,
customaction_input : document.getElementId(message).value,
};
ZFAPPS.set('customaction', updateCustomActionData).then(function(data) {
});
}))}