How to create related field with another module in Vtiger CRM
Vtiger supports a huge number of field types: text, currency, date, percent, and so on. However, in the field manager it is not possible to create a field associated with another module. Below we have prepared for you detailed instructions on how to connect the Purchasing module with the Counterparties.
Vtiger supports a huge number of field types: text, currency, date, percent, and so on. However, in the field manager it is not possible to create a field associated with another module. Below we have prepared for you detailed instructions on how to link the module "Purchases" with "Accounts".
Keep in mind that this instruction will require you to use some MySQL database skills.
Step 1. Create a new field.
Open the field editor in Vtiger CRM. To do this, go to CRM Settings - Modules - Select the Purchasing module - Change fields.
Create a new field in the place you need. Select the field type "Integer". We will need this field in order to store in it data about communication with the counterparty. You can specify the length of the field 10.
Step 2. Change the field type to "Associated with"
To do this, we need to make some changes to the database. The most convenient way is to enter the Vtiger database through PHPMyadmin. Once you have entered the Vtiger database, go to the vtiger_field table and find the field you just created. Most likely, it will be the last in the list if you sort the fields by fieldid field.
Once you have found an entry, click on edit it and change the value of the "uitype" column to "10". Also write down for yourself the id of the field you created, we will need it in the next steps. In our case, it is 787.
Step 3. Create a connection between the modules.
Also, while in PHPMyadmin, find the vtiger_fieldmodulerel table. This is exactly the place where we will register the connection. We must indicate to the system that we are planning a new relationship between Purchasing and Counterparties.
To do this, you should add a new record to the table indicating the data in columns:
- fieldid is the number we wrote down earlier, in our case it's 787.
- module - your current module in which we created a new field, in our case, PurchaseOrder. If you do not know what your module name is, just go to Vtiger in this module, open the list of entries, look at the address bar and see the module name in it: module = PurchaseOrder.
- relmodule is that module with which we make communication. In our case, this is the Accounts module.
- status - do not touch, leave empty.
- sequence - do not touch, leave empty.
After you have made a new record in the database, you can see the working field in the "Purchases" module, which is associated with the "Accounts".
Using these simple three steps, you can add a related field in any other modules.