Skip to main content

How to create a new module for vtiger...

Recently, I had to create a new module for vtigerCRM for my client in current working place. I did search in many places including the official vtiger sites, but couldn’t find a better documentation for my purpose. The latest vtiger version at that time was 5.0.3. Because I had some experience doing lots of core modifications for this system, I did decide to read the source code and find how to add a new module. Finally, I could create a new module and started the project. So, I thought it will be a good thing to write some thing on my blog about this topic, so that others who want to do this thing can read. Given below is a brief description about how to create a new module for vtiger CRM 5.0.3. Source code of this example module is also available to Download.

Step 01: Creating the module directory and minimum required files.

Create a directory called “newModule” inside your vtiger modules directory, or any other name that you prefer. Now, module index file should be created. Create a new file called “index.php” inside the “newModule” directory and insert following code.

And next the “ListView.php” file should be created. This name “ListView” is not compulsory. In fact, you can include any script that you prefer to run when the users are entering to the module. The content of the “ListView.php” is as below.

And now we should create the newModule class file which act as the Model for this module. Actually you can develop this module without following the MVC pattern. But it’s strongly recommended to follow these design patterns if your project is a real one. The content of the “newModule.php” is as follows.

At this point, we have finished developing the Model and Controller. Now the view file (at least one) should be created. Vtiger uses Smarty as a presentation framework. So, the view is a Smarty template. In our example – “newModule.tpl” , and it’s content is given below.

All the required files for our new module were created now. The next thing we should do is attach this module to the System.

Step 02: Attach new module to the vtiger.

At the moment, there is not any automated module management (install, uninstall etc...) facilities in vtiger. Therefore, you can follow the steps given below to attach our new module to the system.

Basically, we should edit following files and inset the some data to the following tables to achieve this goal.






vtiger_tab, vtiger_parenttab, vtiger_parenttabrel


In this file, there is an array called “$parent_tab_info_array”. An element should be entered to this array to show our module in the menu. For this example I will edit the array as given below.


$parent_tab_info_array=array(1=>'My Home Page',2=>'Marketing',3=>'Sales',4=>'Support',



$parent_tab_info_array=array(1=>'My Home Page',2=>'Marketing',3=>'Sales',4=>'Support',5=>'Analytics',


At the end, new element “10=>'newModule'” is added.


In this file there is an array called “$tab_info_array” which contains the details about sub menus. New element should be added into this array for our new module.







'Webmails'=>28,'Users'=>29, 'Nadeeth'=>30);







'Webmails'=>28,'Users'=>29, 'Nadeeth'=>30, 'newModule'=>31);

See, the element 'newModule'=>31 is added to the end. Remember, these indexes (in this case 31) should be modified according to the values in your system.


Now the language file should be modified. Just enter a new element for $app_strings array. For our example, please add the element given below.

'newModule' => 'newModule',

Next step is to add the data related to our module to the tables - vtiger_tab, vtiger_parenttab, vtiger_parenttabrel. The queries given below will do that for you. Here also, please remember to change the values to match with the existing data of your system.

INSERT INTO `vtiger_tab` (`tabid`, `name`, `presence`, `tabsequence`, `tablabel`, `modifiedby`, `modifiedtime`, customized`, `ownedby`) VALUES(31, 'newModule', 1, 31, 'newModule', NULL, NULL, NULL, NULL);

INSERT INTO `vtiger_parenttab` (`parenttabid`, `parenttab_label`, `sequence`, `visible`) VALUES(10, 'newModule', 10, 0);

INSERT INTO `vtiger_parenttabrel` (`parenttabid`, `tabid`, `sequence`) VALUES(10, 31, 1);

Now, we have finished crating new module. Log into the system and you can see there is a new menu in the menu bar.

And new module is installed.


MarkW said…
Great article, but just one problem; why did you have to put the code examples as images? Surely copy-and-paste-able text would have been better...
nadeeth said…
Yes, what you say is correct. But you can download the source code of this example from the download link in the beginning of the article.

Thanks for your comment.
Chris said…
I personally use Code Highlighter:

It's javascript and it's fast. Give it a try ;)
nadeeth said…
Thanks Chris, I did see that. It's a nice tool.I will give it a try next time...
deepsingh said…
i am getting an error and new tab is not shown :

Warning: Invalid argument supplied for foreach() in D:\wamp\www\v-tiger\include\utils\CommonUtils.php on line 1306

kindly help

nadeeth said…
Can you contact me in emails..? send your mail address using the contact form of this site... Thx...
Sreedhar said…
Hi Nadeeth,

First of all thank you very much for posting this article.

While I was following your article for creating a Module in vtigerCRM 5.0.4, I got this strange error.

Invalid argument supplied for foreach() in /var/www/vtigercrm/include/utils/CommonUtils.php on line 1306

Can you please let me know where I went wrong.

Thanks & Regards,
nadeeth said…
As I have mentioned in the beginning of this article, this module development tasks were done by me for vtiger 5.0.3 some time ago. And I haven't check it's compatibility with the newer versions. There may be some little differences, which can easily find reading the code and database.

After all, I will try to find some time to do some works to find the changes in new version.

Thanks for your comment. Keep in touch...
Minh Lam said…
Thank you for you post, it's very useful.
bskumar said… helps me a lot....

bskumar said…
in parent_tabdata.php file:
one more to configure..


at the end, we added 10=>array(31,)
Hardik said…
Thanks a ton Nadeeth,

I have successfully installed the new module.. (with few tweaks because i am using vtiger 5.1.0)

dedy said…
it's a very good tutorial, thanks.
sks said…
thanks u..
it helps me a lot...
samir said…
i spent my whole day trying to add a new tab in the crm but failed..
until i found your guide thanks! keep it up
Richard said…
My version: 5.1.
I could install this well, once installed, I start the application , and I can see the "newModule" new menu option onto the menu bar, but, when I push this new link, an alert message appears:

"newModule module is not active!"

Please, could you tell me how should I activate the module?

Thanks a lot.
patel amit said…
display newMudual but click onthis link error will be generate
"Module name is missing. Please check the module name."
plz rep me
wheelchairs said…
I appreciate your post to create a new module for vtiger, thanks for sharing the post, i would like to hear more about this in future
Idris said…
request help please

I have followed all the steps as guide - but the final result says

newModule module is not active

could anyone advise as how to resolve this issue, am working on vtigercrm 5.2.0

Taraprasad said…
Thnx a lot...

It was helpful... :)
c K said…
I want to create 3 pieces of the accounts module.
Are you can help me
Baibhav Singh said…
Hi nadeeth,

Your blog helped me a lot.

Thanks and Regards
Baibhav Singh
nithyanandam said…
good job dude... but couldnt find the language and $app_string...
please let me know the procedure ASAP
thanks a lot
nithyanandam said…
good job dude
premadarsh said…
Thanks brother..........
eileen said…
Hi, i would like to ask the "insert into" query is supposed to be written in which script? thanks.
Vtiger said…
hi,i have tried to create a new module by using the above code,every thing is OK,but result will not come,it means,the newModule will not shown in menu am using vtigercrm5.4.0 ,please help me to completion of this work through email,my mail id is,plz send the answer to mail id ,if you have possible

Thanks& Regards.
Vtiger said…
Warning: mysql_pconnect() [function.mysql-pconnect]: Can't connect to MySQL server on 'localhost' (10061) in C:\Program Files\vtigercrm-5.4.0\apache\htdocs\vtigerCRM\adodb\drivers\ on line 373
i got this after sign in into vtiger
Vtiger said…
please tel me how
to rectify that error
Unknown said…
You have to use this query in your sql
Unknown said…
Whats wrong ? why do i get an error message
Warning: Invalid argument supplied for foreach() in D:\wamp\www\v-tiger\include\utils\CommonUtils.php on line 1306 ??
Anonymous said…
This comment has been removed by the author.
Redes_2009 said…
Hi, I can't see the new module in the menu bar, what can i do, Im using vtiger 5.4.0
thank you
Redes_2009 said…
Could you find the error???
Kiran said…
This comment has been removed by the author.
Unknown said…
Thank, i solved problem, by replacing
this $app_strings = Array('HELLO_WORLD' => 'Hello World');
by this
$mod_strings = Array('HELLO_WORLD' => 'Hello World');
in lang file
Unknown said…
Thank, i solved problem, by replacing
this $app_strings = Array('HELLO_WORLD' => 'Hello World');
by this
$mod_strings = Array('HELLO_WORLD' => 'Hello World');
in lang file
Unknown said…
Good, it's works on my vtiger 5.4.0
How can i add my own field instead hello world!?
for example text field, check box, and it's must work of couse with database
Thank's said…
Thank you very much for sharing what you found... said…
Actually I did this five years ago.. :-) So, at the moment I don't remember the way I added new fields. But I remember I did many modifications like those. Let me figure it out and let you know when I am free.

Kristian Koci said…
Hi, awesome tutorial, btw can't find the source code file :(
Unknown said…
ts not found
Unknown said…
Hello Nadeth. First of all AWESOME TUTS.
I am facing some issues in creating a vTiger Module for vTiger 6.1. I would appreciate if you can share your Email or Skype.
Please get in touch at or Skype : suntec.jiteen
Unknown said…
Hi everyone
I'm very confused that is where put these files ?. We put all files in C:\wamp\www\crm\modules\newModule but i don't no that location is right or wrong ?. and also talk me how it can be run ?

Popular posts from this blog

Common Characteristics of Enterprise Applications

Last week, I was conducting a tech talk about “Architectural Patterns of Enterprise Applications” with our team. The discussion was mainly based on Marin Fowler's famous book “Patterns of Enterprise Application Architecture”. So, I thought, it's good to write something about that in my Blog. Given below are few common characteristics of Enterprise Applications. If any software product has the following characteristics, we can identify it as an Enterprise Application. These ware originally documented by “Martin Fowler”, in his book “Patterns of Enterprise Application Architecture”. Persistent Data - Enterprise applications usually involve persistent data. The data is persistent because it needs to be around between multiple runs of the program—indeed, it usually needs to persist for several years. Also during this time there will be many changes in the programs that use it. Lot of Data - There's usually a lot of data, a moderate system will have over 1 GB of data organ

How to avoid those little issues one can get when creating new projects with Zend Framwork...

CSS styles my not apply to the templates : Some times this happens when you haven't created a virtual host for the application. After the virtual host is created styles will apply properly, or just use some url helper like "baseUrl" when linking the style sheets to the templates. Error messages when using the commands like "zf enable layout", "zf create db-table ....", "zf create model ...", "zf configure db-adapter", and "zf create action ...." etc... You may get error like "Action 'enable' is not a valid action", "Action 'configure' is not a valid action"......... etc... Reason for this may be, the Zend library is not in the include path. If so add the library path to the include path. Or check whether there are old libraries in any directories of include paths that conflicts with the new one. Check whether there is a one as a PEAR package. And check whether the "zf" c

How to create a waveform animation with HTML and JavaScript

Recently, for a pet project, I wanted to create an animation of a waveform based on the varying decibel level of the microphone input. I was thinking about a really simple way to accomplish this with SVG and JavaScript. Given below is the first sample code I did on the Codepen. You can change this code to use with any framework of your choice. For this sample code, I am using a random number as the microphone input. You can replace it with any other time based input. Code Pen : For this example, you need an HTML code snippet like the one given below. It’s just an SVG with a Polyline element inside.  <div style="text-align:center">   <svg height="150" width="400" id='svg'>     <polyline id="polyline-id" fill="none" stroke="#005c66" stroke-width="1" />   </svg> </div> And then the plain Javascript code to animate the polyline. You can