CreateActionsView changes in Sugar 7.7.0

Matthew Marum —  November 17, 2015

UPDATE December 28, 2015

During Sugar 7.7 upgrade, the upgrader will identify existing create-actions view/layout customizations and automatically migrate them to create view/layout.  This is a best effort migration that follows the two steps listed near bottom of this blog post.

If a custom create view/layout already exists, then create-actions changes will not be automatically migrated.

This will mitigate impact of this change for existing Sugar customers.

If you have been participating in the Sugar 7.7 Beta then you may have noticed that SugarCRM Engineering has refactored how CreateViews work in the Sugar application.

This post explains the motivations for the change and what Sugar Developers need to know and the actions they need to take to migrate their customizations in future Sugar 7.x releases.

Differences between Create and CreateActions

Historically, there has been some confusion in the Sugar Developer community (see here and here) around the existence of two different Create dialog layouts in the Sugar application.

CreateActionsLayout

The CreateActionsLayout includes the CreateActionsView.  This view included additional action metadata that gave the user additional options for saving a new record.  This particular layout was used for the majority of usage flows that created new records in Sugar.  Sugar Developers were taught to customize this view in order to change the behavior of the Create dialog but in reality this was never sufficient to customize the behavior of all possible Create flows.

Create with actions

Create with actions

CreateLayout

The CreateLayout includes the CreateView.  This view did not provide these additional actions.  It was used in certain flows such as when a user chooses to Quick Create a record at the top right corner of the page.  But it was not used nearly as often so a lot of Developers did not customize it or even know about it in some cases.

Create without actions

Create without actions

Relationship between Views

While CreateActionsView extends from the CreateView, they were used on separate layouts.  So while it was possible to customize the base CreateView and have those customizations appear in all possible Create dialogs in the application – a module level customization of the CreateView did not have a similar effect.  This is because the Module’s CreateActionsView ultimately extended from the base CreateView and not the module’s CreateView.  So Sugar Developers were stuck customizing a module’s CreateActionsView in order to change the behavior of most create record flows for a module.  Only sometimes would Sugar Developers separately customize the module’s CreateView when they noticed the Quick Create flow didn’t work the same way.

Relationship between CreateActionsView and CreateView in Sugar 7.6 and previous

Relationship between CreateActionsView and CreateView in Sugar 7.6 and previous

Deprecation of CreateActionsView in Sugar 7.7

It was clear that we did not need to have a separate layout and view to handle small differences in behavior that also created customization challenges.  Plus after some research, we discovered that the additional create actions (such as Save and View) were hardly ever used!  We decided to eliminate some code and confusion.  So in Sugar 7.7, we’ve started the process of merging these views together.  When you set the Sugar log level to WARN in Sugar 7.7 (using the Administration Panel), you will see warning messages that the CreateActionsView and CreateActionsLayout are deprecated in your JavaScript console whenever they are used.

Screen Shot 2015-11-16 at 5.32.25 PM

They will be completely removed in a future release (currently planned for Sugar 7.8).

CreateActionsView is deprecated in Sugar 7.7 and is planned to be completely removed in Sugar 7.8.

The benefit is that Sugar Developers will only need to customize a single view to change the behavior of all create record flows.

Migrating customizations to CreateView and CreateLayout

The action that every Sugar Developer needs to take is to migrate their CreateActionsView  (clients/base/views/create-actions/) customizations to the CreateView (clients/base/views/create/).  This will prepare you for when CreateActionsView is removed completely.

This can be as easy as the following two steps:

  1. Copy each custom|modules/.../create-actions/create-actions.js file to custom|modules/.../create/create.js
  2. Change extendsFrom: '*CreateActionsView' to extendsFrom: '*CreateView' within the new files

If you were launching the create drawer, then you should use the CreateLayout (create) instead of the CreateActionsLayout (create-actions).

For example, use this

app.drawer.open({
    layout: 'create',
    context: {
        create: true,
        ...
    }
});

not this

app.drawer.open({
    layout: 'create-actions',
    context: {
        create: true,
        ...
    }
});

Sugar Developers need to customize CreateView for their create dialog customizations in Sugar 7.7 and later

Matthew Marum

Posts

Matt is the Director of Developer Advocacy for SugarCRM. Previously he was an Engineer on Sugar 7 and a Solutions Architect for the OEM program. He is also an avid trail runner, Boston Marathon qualifier and a karaoke aficionado.

8 responses to CreateActionsView changes in Sugar 7.7.0

  1. 

    Matt:

    Thank you for your detailed article.

    Wouldn’t it make more sense to remove the create view and keep the create-actions view? This would minimize the impact on existing customizations.

    For those of us with hundreds of Sugar deployments (OnDemand and On Premise), such a simple change can take thousands of hours to correct, test, and deploy.

  2. 

    Thanks for the article Matt!

    But as Jeff suggested it would be great if we can keep create-actions view and remove create view instead. Because create-actions view customization are very common and it will take a lot of effort to do this change in already existing 7.x deployments.

    Thanks!

  3. 

    i’m with @bickart, is more sense to remove the create view and keep the create-actions view for all of us.

  4. 

    Good day. Have a question about this change. Currently using a custom dropdown action on create like the one here for example http://prntscr.com/96eccc
    What would the change entail? Just override the create.php in custom with my subaction dropdowns ?
    array(
    ‘type’ => ‘actiondropdown’,
    ‘name’ => ‘main_dropdown’,
    ‘primary’ => true,
    ‘switch_on_click’ => true,
    ‘showOn’ => ‘create’,
    ‘buttons’ => array(
    array(
    ‘type’ => ‘rowaction’,
    ‘name’ => ‘save_custom_button’,
    ‘label’ => ‘LBL_SAVE_BUTTON_LABEL’,
    ‘events’ => array(
    ‘click’ => ‘button:save_custom_button:click’,
    ),
    array(
    ‘type’ => ‘rowaction’,
    ‘event’ => ‘button:duplicate_button:click’,
    ‘name’ => ‘duplicate_button’,
    ‘label’ => ‘LBL_SAVEDUPE’,
    ‘acl_module’ => ‘Opportunities’,
    ‘acl_action’ => ‘create’,
    ),
    etc.. etc..
    ),

    • 

      Hi Caim,

      Yes, you could extend the CreateView metadata very similar to before. For example, you could create an extension that adds your custom dropdown actions as an Extension.

      For example,

      custom/Extension/modules/Accounts/Ext/clients/base/views/create/custom_button.php

      ‘custom_button’,
      ‘type’ => ‘button’,
      ‘label’ => ‘My Custom Button’,
      ‘css_class’ => ‘btn-link’,
      ‘showOn’ => ‘create’,
      ‘events’ => array(
      ‘click’ => ‘button:custom_button:click’,
      )
      ),
      array(
      ‘type’ => ‘actiondropdown’,
      ‘name’ => ‘create_dropdown’,
      ‘primary’ => true,
      ‘showOn’ => ‘create’,
      ‘buttons’ => array(
      array(
      ‘type’ => ‘rowaction’,
      ‘event’ => ‘button:dropdown1:click’,
      ‘name’ => ‘tdd1_button’,
      ‘label’ => ‘Test Drop Down 1’,
      ‘acl_action’ => ‘create’,
      ),
      array(
      ‘type’ => ‘rowaction’,
      ‘event’ => ‘button:dropdown2:click’,
      ‘name’ => ‘tdd2_button’,
      ‘label’ => ‘Test Drop Down 2’,
      ‘acl_action’ => ‘create’,
      ),
      array(
      ‘type’ => ‘rowaction’,
      ‘event’ => ‘button:dropdown3:click’,
      ‘name’ => ‘tdd3_button’,
      ‘label’ => ‘Test Drop Down 3’,
      ‘acl_action’ => ‘create’,
      ),
      ),
      ),
      ));

  5. 

    Thanks everyone. We’ve added a Sugar 7.7.0 upgrade script that will migrate create-actions view/layout code customizations to create view/layout. This will mean that the majority of create-actions customizations installed on existing Sugar 7 instances will be migrated automatically. This will provide a lot of savings in time and development costs to Sugar customers and Sugar Developers. I’ll share some more details in an upcoming blog post.

  6. 

    Matt, is there a way to add the “Save and View” and “Save and Create New” buttons back to all modules without replicating code for each module?

Trackbacks and Pingbacks:

  1. Update on CreateActionsView changes in Sugar 7.7 « Sugar Developer Blog – SugarCRM - December 29, 2015

    […] CreateActionsView changes in Sugar 7.7.0 […]