Wednesday, February 24, 2016

Building Our Demo Module


To build our demonstration module we are going to use a combination of ModuleBuilder and an editor to add additional customizations that can not be made directly in SugarCRM.

To get started lets go to Admin.

Now lets open Module Builder, which can be found in Developer Tools.

The first thing we are going to do is build a package that our new module will be part of.  Select New Package.


We can give our package any name that has meaning to you. For this example we are going to name our package DEMOS.

The author is a reference so that you know who built the module.

The KEY will be used as part of the name of your module and be used as part of the table name in the database. We use NEPO as the key for all of our modules. You should use a KEY that makes sense for your computer.  If your company is publically traded, use your stock sybmol.  


Next we are going to add a module to our DEMOS package.  We are going to use the basic module type.

The Module Name is what the module will be called when you are referencing it in the code and be the module directory and the table name. We are going to use DEMO. Our full module name will become our KEY_MODULENAME so this will become NEPO_DEMO

Label is what will appear on the screen in english.  You can add translations latter if you would like to.

In this example, we are not going to support importing or teams.

We want a navigation tab so that it will appear in SugarCRM's menus.



Once our module has been created, we are going to add some fields.

Our first field will be a dropdown called status.
We are going to use the existing case_status_dom for the dropdown options.

 Next we are going to add a textfield webservice_id. This field will be auto populated from a webservice call.


Next we are going to add another drop down, this time it is called edition.

We are going to add a new drop down list. 



When we are done, you should have added 3 fields to the DEMO module.


Next we are going to edit the Layouts.

Open the EditView.
Check the Sync to DetailView checkbox
Add our fields to the screen
and remove the team_id from the default screen as we are not going to use the teams.
The EditView should end looking like



Next edit the QuickCreate and press the Copy from EditView button


Next we are going to update the ListView


 Next update the BasicSearch and AdvancedSearch

We are going to add two relationships.
We want to have a many to many relationship with Contacts and Leads



When you are done your relationships should look like


Let's use some SugarLogic to modify set the name.

Go to Fields 
Select the field name
Click the checkbox by Calculated Field
Then use this as the formula


We are ready to deploy our module.


Once deployed, we can test the module in SugarCRM and see how it works.


In our next article we we add some customizations that need to be done in an editor.


No comments:

Post a Comment