Custom Functions
Custom Functions in Zoho Expense allows you to simply drag and drop code to automate your business processes. Using custom functions, you can update the data in a related database or a third-party application automatically by executing simple program scripts, which are written using the low-code programming language, Deluge.
Using Custom Functions in Zoho Expense, you can program scripts using Deluge Script, associate them to workflow rules, and automate the process based on your organization’s needs.
For example, let’s say your organization uses a fleet of vehicles to help your employees to commute from home to office and back. The head of transportation in your organisation wants to implement a new system wherein the employees are prevented from creating mileage expenses in Zoho Expense for the expired vehicles. This new system will help save a lot of time as approvers spend a lot of time rejecting the mileage expense reports for expired vehicles. Using the custom functions in Zoho Expense, you can simply use the deluge scripting language and associate them to workflow rules to simply prevent employees from creating mileage expenses for expired vehicles.
Similarly, you can create such custom functions and automate such unique processes based on your organizational needs.
Create Custom Function
- Click Admin View.
- Go to Settings on the left sidebar.
(OR)
Click the Gear icon at the top right side. - Click Actions under Automation.
- Switch to the Custom Functions tab.
- Click + New Custom Function in the top right corner.
- Enter the name and description for your custom function.
- Select the module for which you want to trigger the custom function. You can create custom functions for expense reports, employee advances, trips, users, and employees’ advance refunds.
- Write the function in the deluge script editor.
- Click Save.
Insight: Deluge or Data Enriched Language for the Universal Grid Environment is an online scripting language that lets you program your own functions and add different types of business logic as required.
Pro Tip: You can quickly access the support and guide related to Deluge in the top right corner of deluge script editor.
Associate Custom Function to a Workflow Rule
The custom function that you create should be associated with a workflow rule. Whenever a record matches the criteria in a workflow rule and the workflow rule is triggered, the associated custom function will also be executed automatically.
- Click Admin View.
- Go to Settings on the left sidebar.
(OR)
Click the Gear icon at the top right side. - Click Workflow Rules under Automation.
- Click + New Workflow Rule in the top right corner.
- Enter a Name and Description for your workflow.
- Select a Module for which you want to trigger the workflow.
- Choose the Workflow Type and when you want to trigger the workflow.
- Besides the Event and Date-based triggers, you can optimize the triggers by setting additional filters under Filter the triggers.
- Under Actions, choose the Type as Custom Functions and select the custom function you want to associate with the workflow rule.
- Click Save.
Edit Custom Function
To make changes to the custom functions you have created:
- Click Admin View.
- Go to Settings on the left sidebar.
(OR)
Click the Gear icon at the top right side. - Click Actions under Automation.
- Switch to the Custom Functions tab.
- Hover over the custom function you want to edit and click the More icon next to the custom function.
- Click Edit and make the necessary changes.
- Click Save.
Delete Custom Function
You can delete a custom function permanently. Once you’ve deleted a custom function, the custom function related to a workflow rule will no longer be executed.
To delete: