VTiger’s module layouts and fields are meant to be customized. Most often we change layout of a module based on client’s preferences or maybe because of some business requirements. No problem since we could easily customize module layouts and fields under Module Management settings; But what if your client needs a more complex functionalities? like dynamic fields? (show/hide fields based on another field value). Thought of some extension like VTiger dynamic fields?

There’s actually a lot of extensions out there like Conditional Layouts for VTiger that will help you configure your module layouts and fields. With this extension, you can hide field in VTiger module based on another field value.

Another solution is to use the dependent field/block feature of VTiger. One problem, when we tried to navigate to CRM settings, Module Layouts and fields under Module Management , we can’t see dependent field/block tab. The only tabs displayed are Details View Layout, Relationships, and Duplicate Prevention. We thought that VTiger version 7.1 doesn’t have the dependent field/block feature. Found out that the VTiger version isn’t the issue, dependent field/block feature IS NOT implemented to the community version of VTiger.

vtiger dynamic fields settings crm settings module management module layouts and fields dependent field or block tab missing

Another option is Dynamic Blocks, an extension that will give you the capability to show or hide blocks based on picklist value.

All the options above we have given you require you to spend a dime to acquire them. Medium to big companies could surely afford to invest on those extensions from VTExperts. For small businesses or for some VTiger users who don’t want to spend $69 per month; if you’re willing to put an effort to create your own VTiger dynamic fields then continue to read. We will share you the steps to make module fields and blocks become dynamic using Javascript/JQuery.

Remarks

We’ll give you an example code in javascript to be modified and uploaded to your server. As an example, we will use Sales Order module to implement VTiger dynamic fields and blocks. You don’t need to worry since this tutorial is applicable to any module in VTiger.

This tutorial uses the latest version of VTiger CRM — VTiger 7.1. You may upgrade your VTiger CRM first before proceeding.

Remember that it is required that you have permission to create and modify your VTiger files.

Steps to Create VTiger Dynamic Fields And Blocks

Let’s create a little scenario here. When a user selects a value from a picklist element we will show/hide some fields and blocks.

Step 1: Connect to the server where your VTiger CRM is hosted. You can do this using CPANEL or FTP solutions such as FileZilla or WinSCP (if you’re on Windows). Navigate to your-vtiger-crm/layouts/v7/modules/vtiger/resources directory and create your-javascript-file.js. See how we created the escrie.js file.

vtiger dynamic fields ftp vtiger layouts v7 modules vtiger resources

Step 2: Copy and paste the following javascript/jquery code to your newly created javascript file.

vtiger dynamic fields and blocks show hide fields blocks based on another field value 1

After selecting Job Order from Order Categories.

vtiger dynamic fields and blocks show hide fields blocks based on another field value 2

Notice that some of the fields and blocks disappear. Feel free to choose which SELECT ELEMENT you want to use — fields and blocks will depend on.

What We Have Learned

VTiger dynamic fields and blocks is a really helpful feature for us VTiger developers when creating fields or blocks with dependencies.

There’s a lot of existing solutions out there created by team of experienced developers such as VTExperts. You may choose paid extension to save time and avoid development works.

The solution that we have created here can be implemented on other VTiger version.

You may also want to read add contact to your VTiger CRM using VTiger API.

That’s all, we hope this tutorial about VTiger dynamic fields and blocks using javascript/jquery helped you create a free solution to show/hide fields and blocks in VTiger.