Updating a record from a list view using the action dropdown

I'm still on the learning curve as a SugarCRM developer. I've done significant amounts of development on the back end (logic hooks, database work, scheduled jobs) but am still learning the ropes on the front end. I could really use some help understanding how to make this happen.

We have a custom module that includes a status dropdown. A set of our users spend much of their day in the list view of this module. One of their key actions is to update this status field. I've been asked to enable updating this status directly from the list view, which would simplify their workflow a lot.

I modified the modules recordlist.php file to add the status options in the dropdown (see the attached image). So if they select "Mark Complete", the status field should be updated to "Complete." The column in the listview should update to refresh the new value as well.

How do I make it so Sugar is "listening" for this action and makes the appropriate update?

Does the update of the record itself happen in Javascript on the front end? Or does the action trigger a process/call on the backend, with PHP code ultimately updating the field and saving it?

Thanks for any help you can provide.

  • I am not sure you are approaching this in the most efficient way.

    The user can use the Edit on the list view to update each line one by one but the easiest would be to add the status to the mass-update, that way they can check the boxes on the left for all the lines to be updated to a given value and then just select the status to assign.

    See if these links help:

    Adding a field to Mass Update:


    Alternatively, you could add a List View Action (not Row Action) to mass update the status to the value you want on a whole set of selected list-view records, effectively doing a one-click mass update.

    For example, in my Cases module I added an action to close as spam in


    in the actions array:


    array (
            'name' => 'close_as_spam',
            'label' => 'LBL_CLOSE_AS_SPAM_ACTION',
            'acl_action' => 'edit',
            'events' => array(
              'click' => 'list:closeasspam:fire',

    I then extended the controller and defined the code to execute when the event fires:


       extendsFrom: 'RecordlistView',

       initialize: function(options){
          this._super('initialize', [options]);
          //define the event for the close as spam action
          this.context.on('list:closeasspam:fire', this.closeAsSpamClicked, this);

       //execute the update
       updateRecords: function(params){
         var self = this,
             url = app.api.buildURL('Cases/MassUpdate');
           success: function(o){
             self.layout.context.reloadData({showAlerts: false});
             var massCollection = self.context.get('mass_collection');
           error: function(e){
             app.alert.show('error_while_mass_update', {
               title: app.lang.getAppString('ERR_INTERNAL_ERR_MSG'),
               messages: app.lang.getAppString('ERR_HTTP_500_TEXT')
       //set the values to update
       closeAsSpamClicked : function() {
         var ids = _.map(this.context.get('mass_collection').models, function(selected_model){return selected_model.id}),
             params = {
                 'resolution':'Closed as Spam',

    Note that all this does is leverage the MassUpdate to set the status, resolution and case_closed_reason_c (custom field) without the users having to set those themselves.


    If you wish to go down the path of custom rowaction events

    in custom/modules/<yourModule>/clients/base/views/recordlist/recordlist.php

    you will have added an item in the rowactions array.

    You now need an event handler for your custom event in the controller

    in custom/modules/<yourModule>/clients/base/views/recordlist/recordlist.js

    and define what to do when the event is fired

    Hope this helps,

  • I went through your code a bit. It looks like I need to use app.api.call to make a call to the API and update the status for this specific record. I will play with that a bit and see if I can get it working. Thanks again.

Reply Children
No Data