Create new user as duplicate setup of existing user

Is there a way to create a User Template and then from that template duplicate it for each user being created?

I have 4 levels of Users with each level having ascending levels of privilege and a setup with Dashlets, System settings, Group Memberships, …

Rather than recreate all that each time I enter a new user, I am looking for a way to duplicate an existing setup.

Any ideas?


  1. Add 4 levels of configuration as a field for the Users module.
  2. Create a logichook that will duplicate the configuration for each level.


Never thought of that, thank you.

I can see that with that idea I can pre-set fields.

Is there a way, using code, that I can pre-set things like Dashlets, Time Zones, … that I can do via the USer Management option in the Admin panel?



Yes, it’s possible.
A lot of user parameters are stored in module “UserPreferences”.

As per @p.konetskiy 's idea, you can setup a custom dropdown field which identify the 4 possible templates. For each template you specify a set of metadata files (dashlets, time zone etc) whose data are going to be fetched by an ajax request on choosing some option from that custom dropdown field.

@p.konetskiy @andopes

Thank you for your quick replies.

I looked at the fields available in the Users module and, based on the follow-up help which identified the need for API calls, I relaize this is going to require some homework on my part. I have never used SuiteCRM’s API calls before.

So I will look into this for future use, but have other things to work on right now. I did not want to leave your feedback unacknowledged though so thank you.

Ajax is not needed. This is a difficult option. It will be easier to create a logichook (look at documentations: Logic Hooks :: SuiteCRM Documentation).


I have used Logic Hooks quite a bit for other applications. I posted something quite a while ago to track Users’ Login and Logout activity

But I do not see how to set the Dashlet arrangements via Logic Hooks. What I want is to have 4 User levels and have an easy way to setup each, which includes pre-configuring Dashlets, Mutli-Factor authentication, Time Zone, … and many other things.

I see you have done this

but I do not see how.

Can that be done via Logic Hooks without APIs?


I wrote already. Look at file - ‘include/MySugar/MySugar.php’ (also see the file - ‘modules/Home/index.php’)

This is an approximate code for your logichook (user, after_save). I didn’t test it but planing to use.

if (!is_file(sugar_cached('dashlets/dashlets.php'))) {

    $dc = new DashletCacheBuilder();
require_once sugar_cached('dashlets/dashlets.php');
$currentListDashlets = array(<module_name>, <dashlet_name>); //<array_for_current_user>
$dashlets = array();
foreach ($dashletsFiles as $dashletClass=>$dashletModule) {
   if (in_array($dashletsClass, $currentListDashlets)){
       $dashlets[create_guid()] = array('className' => $dashletName,
          'module' => $dashletClass['module'],
          'forceColumn' => 0, // or 1
          'fileLocation' => $dashletsFiles[$dashletClass]['file']
$count = 0;
$columns = array();
$columns[0] = array();
$columns[0]['width'] = '60%';
$columns[0]['dashlets'] = array();
$columns[1] = array();
$columns[1]['width'] = '40%';
$columns[1]['dashlets'] = array();

foreach ($dashlets as $guid=>$dashlet) {
    if ($dashlet['forceColumn'] == 0) {
        array_push($columns[0]['dashlets'], $guid);
    } else {
        array_push($columns[1]['dashlets'], $guid);
// saving dashlets for user.
$bean->setPreference('dashlets', $dashlets, 0, 'Home');

$pages = array();
$pageIndex = 0;
$pages[0]['columns'] = $columns;
$pages[0]['numColumns'] = '3';
$pages[0]['pageTitleLabel'] = 'LBL_HOME_PAGE_1_NAME'; // Or setting other label
// saving dashlet pages for user.
$bean->setPreference('pages', $pages, 0, 'Home');


Thank you!

I have a few things to owrk out here on a new launch and once though that will look at this.

Appreciate the guidance.

I am changing




As in logichook