Articles in this section
Authenticate Emails with SPF, DKIM, and SenderID Auto forward your emails to Vtiger Managing User Profiles Automate Outgoing Emails in Email Settings Automation - Approvals Automation - Assignment Rules Set up Multi-path Workflows Creating a Scheduled Workflow Automation - Workflow Scheduler Workflows in Vtiger CRM Webforms in Vtiger CRM Set up a Workflow Action to Create Event Set up a Workflow Action to Create Records Set up a Workflow Action to Create Task Set up a Workflow Action to Create an SMS Task Set up a Workflow Action to Send Mails Workflow Action to Update Fields Automation - Webhook Workflow Automation - Expressions Workflow Configuration - Business Hours Configuration - Company Details Configuration - Consents Configuration - Customer Portal Maps in Vtiger CRM Configuration - Usage Details Configuring Encrypted Data Fields in Vtiger CRM Configure Picklist Dependencies Considerations for Deactivating Vtiger Users Control Fields and Record Displays using Configuration Editor Create Reminders for Records and Inbox Create a field of a Grid type Dealing with Currencies and Taxes Enable Desktop Notifications on Chrome Web Browsers Vtiger CRM Add-ons IMAP Configuration - 2-way sync between Vtiger and IMAP providers Setting up Autopay & Payment Gateways Inventory - Tax Management Inventory - Terms and Conditions Login to Vtiger on SSO SAML using ADFS Mailroom Functionality for Different Scenarios Manage Multiple Currencies Marketing and Sales - Deal to Project Mapping Marketing and Sales - Lead Conversion Data Mapping Marketing and Sales - Profile Scoring Module Management - Labels Editor Module Management - Module Numbering Configure My Preferences Feature My Preferences - Calendar Settings Tags in Vtiger My Preferences - Notification Preferences SAML Support in Vtiger CRM Vtiger Mailroom Settings - Configure Module Settings Settings - Create Dynamic Fields and Layouts Module Management - Creating a Relationship Between Modules Settings - Customize Records and Fields for your Business Settings - How to set email autoresponder to Webform submission? Settings - Left Menu Settings - Manage Global Picklists in Vtiger Settings - Set up your Support Team Settings - Start Up Page Settings - Working with Picklist Values Module Management - Module Builder Support - SLA Policies Troubleshooting Login Issues Add-Edit Unsubscribe Links in your Email Template User Management - Authentication User Management - Encrypted Field Access Logs User Management - Groups User Management - Login History User Management - Profiles User Management - Roles User Management - Settings Log User Management - Sharing Rules User Management - Users User Management - Vtiger Support Access Vtiger Buzz - Chrome Extension for Notifications Vtiger Implementation wizard Vtiger Language Support Configuring Websense Trackers Websense - Widgets Duplicate Prevention in Modules Module Management - Modules Module Management - Module Layouts & Fields Generate and Manage Third-party App Passwords in Yahoo Configuring App Passwords for Gmail Outgoing Server and Yahoo Mail Configuration - Storage Guard Customizing your Self-Service Portal Theme Using CSS Styles Automation - SMS Reply Actions Adding Hidden Fields to a Webform Configuring Dependent Fields and Blocks for Modules Auto forward Emails from Microsoft Office 365 Adding Custom Module Login Page Customization Settings - Personalize Module Layouts Formula Fields Creating Custom Filters Adding a local DNS Entry

Set up a Workflow Action to Invoke Custom Function

The Workflows module provides you with a simple interface to add custom actions that execute on saving an entity.
R
Ruba
17 Jul, 2025 - Updated  23 days ago

Feature Availability

Vtiger Editions: One Professional | One Enterprise | One Growth


 

Introduction

The Workflows module in Vtiger CRM offers a straightforward interface to define custom actions that are executed when a record is saved.

To extend this functionality, Vtiger provides a Custom Task feature using entity method tasks. This allows developers to call specific methods on Vtiger entity objects, enabling the execution of custom business logic within a workflow.

Let’s walk through how to create a Custom Task.

For instance, if you want to calculate a natural logarithm (Math Log) as part of a custom operation, you would first register a method to handle this logic. The registration process includes defining an operation name, specifying the file path (which can be in any module, including a custom one), and setting the function name.

Suppose you have a custom module named Deals. You can register the method within the module’s postinstall event using the vtlib_handler API in the Deals.php file. This event is triggered automatically after the module is installed, allowing your custom method to become available to workflows.

To learn more about this, click here.

In this article, you will learn about:

  • Setting up and invoke custom function workflow action

Setting Up an Invoke Custom Function Workflow Action

Note

  • We have taken the example of the Deals module only for better understanding. To learn more about Deals, click here.
  • Make sure you have registered the custom function in the module’s vtlib_handler method. 

Example:

 
 
 

Follow these steps to set up the workflow with a custom function:

Section 1: Accessing the workflow page

  1. Click the User Menu on the top right corner of the screen.
  2. Click the Settings button. The Settings page opens.
  3. Look for the Automation section.
  4. Select Workflows.
 
  1. Click the +New Workflow button.
  2. Select Standard. This opens the New Standard Workflow page.

Section 2: Entering the basic information

 
  1. Enter or select the following details:
    1. Workflow name: Enter the workflow name as Calculate Log for Deal amount.
    2. Target module: Select Deals as the target module.
    3. Status: Set the status to Active.
    4. Description:  Enter a description that explains the purpose of the workflow action.
​​​​​​​
 

Section 3: Select the workflow trigger

 
  1. Select the Workflow Trigger as Deal Updated (Includes Creation).
  2. Select Every time conditions are met for Recurrence.
​​​​​​​

Section 4: Set up the workflow entry criteria​​​​​​​

 
  1. Click the +Add Condition button.
​​​​​​​
 
  1. ​​​​​​​Set the entry criteria as: Amount is not empty.
​​​​​​​
 

Section 5: Set up the action

 
  1. Click the Add Action drop-down.
  2. Select Invoke Custom Function. This opens a window where you must enter the Action Title.
​​​​​​​
 
  1. Enter the Action Title as Calculate Log.
  2. Select the Method Name for the specified action.
  3. Click Save to save the action.
  4. Click Save to save the workflow.

Now when a Deal is created or updated with an amount, the workflow will calculate the natural logarithm and store it in the specified field.


​​​​​​​Note: If you want to update the Purchase cost of Products based on the List price given for the Product in the latest Purchase Order, do the following:

  • The admin has to select the custom function when creating a workflow for PO,
  • The custom function will update the Item's Purchase Cost based on the following formula:
    • ((Qty*List price)-Item level discount)/ Qty
  • This should update the Purchase cost for all the Items selected in the PO/Bill.
  • The latest selected price is recorded if the same product is selected in the PO or Bill more than once.
    • For example, if the product - Glass is selected in the 3rd and 7th fields with prices of 400 and 600, respectively, then the price of the 7th field, that is 600, is recorded.
  • Ensure that the ModTracker entry should be added to the Product and the Product or service workflow should not be triggered.
 
 

References

Related articles
Workflows in Vtiger CRM Set up a Workflow Action to Create Event Set up a Workflow Action to Create Task Set up a Workflow Action to Create Records Workflow Action to Update Fields
Home Privacy Policy Terms of Service Security Center Policy & Legal Center Contact Us
© Copyright 2025 Vtiger. All rights reserved.
Powered by Vtiger
Facebook Twitter Linkedin Youtube