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.


  1. 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...

  2. 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.

  3. I personally use Code Highlighter:

    It's javascript and it's fast. Give it a try ;)

  4. Thanks Chris, I did see that. It's a nice tool.I will give it a try next time...

  5. 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


  6. Can you contact me in emails..? send your mail address using the contact form of this site... Thx...

  7. 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,

  8. 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...

  9. Thank you for you post, it's very useful.

  10. helps me a lot....


  11. in parent_tabdata.php file:
    one more to configure..


    at the end, we added 10=>array(31,)

  12. Thanks a ton Nadeeth,

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


  13. it's a very good tutorial, thanks.

  14. thanks u..
    it helps me a lot...

  15. 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

  16. Hello
    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.

  17. display newMudual but click onthis link error will be generate
    "Module name is missing. Please check the module name."
    plz rep me

  18. 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

  19. 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


  20. Thnx a lot...

    It was helpful... :)

  21. Hi,
    I want to create 3 pieces of the accounts module.
    Are you can help me

  22. Hi nadeeth,

    Your blog helped me a lot.

    Thanks and Regards
    Baibhav Singh

  23. good job dude... but couldnt find the language and $app_string...
    please let me know the procedure ASAP
    thanks a lot

  24. Thanks brother..........

  25. Hi, i would like to ask the "insert into" query is supposed to be written in which script? thanks.

  26. 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.

  27. 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

  28. please tel me how
    to rectify that error

  29. 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 ??

  30. This comment has been removed by the author.

  31. Hi, I can't see the new module in the menu bar, what can i do, Im using vtiger 5.4.0
    thank you

    1. This comment has been removed by the author.

  32. 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

  33. 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

    1. Thank you very much for sharing what you found...

  34. 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

    1. 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.


  35. Hi, awesome tutorial, btw can't find the source code file :(

  36. We are a team of experts who have a long and well experience in different open source systems, especially in vTiger ,

    Our long experience gave us the opportunity to start on creating and developing to make vTiger a better CRM and to help vTiger users to be able to organize their business what ever it was,

    By using our new modules and integrations you will be able to focus your manpower on bringing new opportunities and leave the rest to your CRM

    1. Hello Noor, I am looking forward for creating a Module for vTiger 6.1.
      If you can be of any help, please get in touch at OR Skype me at : suntec.jiteen

    ts not found

  38. 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

  39. 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 ?

  40. Hello there! I found your blog using on Google. This is a really well written article. I will be sure to bookmark it and return to read more of your useful information. I’ll definitely return. Thanks for the post.
    Handicap Tricycle Price
    Deluxe Tricycle Handicapped

    Keep Posting:)


Post a Comment

Popular posts from this blog

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 replac…

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 organized in…