SugarCRM 6.4 Users and Employees Support in Studio

sugarcrmdevelopers —  February 14, 2012 — 16 Comments
Beginning with the SugarCRM 6.4 release, we have added support to modify the Employees and Users module in Studio.  Now you may add custom fields and make modifications to the layouts without having to manually edit PHP code.
In case you may not know, the Employees and Users modules both share the same database tables, but retain separate files for layouts and language strings.  This distinction is important as there are some caveats to be aware of which I will discuss later.
Imagine the Employees as being a subset of Users.  This is because there may be Users in the system that may be used for special purposes.  Such users may not have access to the system through the login screen.  Among such users are the Group and Portal users.  Employees, however, may be thought of as the people that actively use the system.  You may read more about the functions of the Group and Portal through the administrator guide.  For the purposes of this developer post, I will just highlight some of the features of the new Users and Employees support in Studio.

Editing Layouts

The following table highlights the layouts available for the Employees and Users modules.

Layout Users Employees
 EditView  x  x
 DetailView  x  x
 ListView  x  x
 QuickCreate  x  x
 Popup ListView  x  x
 Popup Search  x  x
 Basic Search  x  x
 Advanced Search  x  x
 Mobile EditView  x  x
 Mobile DetailView  x  x
 Mobile ListView  x  x
 Mobile Search  x  x
 User Holidays Subpanel  x
 OAUTH Access Tokens Subpanel  x

Both modules basically share the same layout options with the exception of the additional two subpanels for the Users module. The User Holidays Subpanel and OAuth Access Token Subpanel layouts appear on the Users module’s DetailView.

The studio layout management for the Users module is similar to that of other modules. You may rearrange fields, add rows, remove rows, etc. The Display panels as tabs checkbox option only affects the layout of the User Profile tab for the Users module. The Users layout screens that you may modify via Studio will always be contained inside a set of system level tabs such as the Advanced, Access and Downloads tabs. These system level tabs vary depending on the type of user record viewed as well as the user’s permissions.

The studio layout management for the Employees module is more simple. By default there is only one panel for the DetailView and EditView layouts. Unlike the Users module there is no enforced system level tabs so the Display panels as tabs checkbox option will allow you to create tab layouts for all panels.

Custom Fields

Because the Users and Employees modules share the same database table, adding custom fields to Users will result in the field appearing in Employees and vice versa. The users_cstm table stores the database value and database attributes of the field only. Other field attributes such as whether or not the field uses a formula, a dependency on another field, is importable, etc. are contained in the module’s variable definition. This information is stored in files in the custom directory as well as in the fields_meta_data database table. The end result is that adding a custom field to the Users will make the custom field available to the Employees module and vice versa. However, the layout placement and the display label of the custom field will not be carried over and these are the caveats to be aware of. This is so because the language and layout files for the Users and Employees modules reside in different directories. By enabling studio support for the Users and Employees module, we wanted to give the administrator the option to decide which fields are pertinent to a particular layout and how to label such fields accordingly. In the event that a display label key was already used by the complementary module, we also did not want to override the label value. So you will see that adding a custom field with a label in the Users module will also add the custom field to the available list of fields in the Employees module, but that the display label value will default to the label key used in creating the field for the Users module.  You may look at the fields_meta_data table to see which are the common values shared across both modules.


The following table highlights the custom field properties and whether creating a custom field in either module will have the resulting property copied over to the complementary module.

Field Property Duplicated
Data Type  Yes  type column in fields_meta_data
 Field Name  Yes  name column in fields_meta_data
 Display Label  No  Resides in individual language files
 System Label  Yes  vname column in fields_meta_data table
 Help Text  Yes  help column in fields_meta_data table
 Comment Text  Yes  comments column in fields_meta_data table
 Default Value  Yes  default_value column in fields_meta_data table
 Max Size  Yes  len column in fields_meta_data table
 Calculated Value  Yes  In Extensions/modules/Users/Ext/Vardefs/sugarfield_[name]_c.php and modules/Users/Ext/Vardefs/vardefs.ext.php
 Dependent  Yes  In Extensions/modules/Users/Ext/Vardefs/sugarfield_[name]_c.php and modules/Users/Ext/Vardefs/vardefs.ext.php
 Required Field  Yes  required column in fields_meta_data table
 Audit  Yes  audited column in fields_meta_data table
 Importable  Yes importable column in fields_meta_data
 Duplicate Merge  Yes duplicate_merge column in fields_meta_data

Upgrades

A note on upgrades.  In 6.4, we will move the following Users files into the custom/backup directory upon upgrade:

modules/Users/DetailView.html

modules/Users/DetailView.php

modules/Users/EditView.html

modules/Users/EditView.php

In summary, the 6.4 release has exposed the Users and Employees modules through studio. This was a requested feature from many of our customers. Because of the dynamic nature of many of the fields in these two modules, the metadata files contain a lot more customizations. We will dive into this in a future article, but for now, we hope that enabling the administrator to add some custom fields and configure layouts through studio for the Users and Employees greatly empowers your business!

16 responses to SugarCRM 6.4 Users and Employees Support in Studio

  1. 

    Hi, I managed to add custom field in Users module, and then added it in Employee Layouts. When I display “Users” I see value. However, when I display “Employees”, value seem to be empty. Why?

  2. 

    Thanks for this one John.
    Prevent me from the headache so I know the strange behaviour is normal. I mean you’re aware of it and as this is something we can deal with over the studio it is fine.

  3. 

    What is the table name for Employees & Users?

  4. 

    Is there anyway of disabling access to the Employee module?

Trackbacks and Pingbacks:

  1. Sugar CRM Mobile | SugarCRM Mobile | Sugar CRM iPhone | SugarCRM iPad | CRM Solution Comparison - September 27, 2012

    […] the Employees module, users can view records; administrators can create and manage […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s