Give us contact

Do you prefer to ask us directly?

Call us +420 605 203 938 (the Czech Republic)

or use this contacts

AyMINE

Related links


FI - Finance Management

Multiple-object update implementation

Framework supports multiple object updates that can be implemented to any object

The solution concept

Multiple object update is used to change one or more object attributes for several selected object at once. Functionality is requisite for effective bulk operations.

How to define multi-update dialog

The multiple-update dialog is a common clip called by a default button for multi-object related operation. The name of the clip (massUpdate) is recommended but not required.

The massUpdate clip should not load data and shall be set as using data from the caller object "clipParams":{ "useParentData":true}.

The common method for multiple update is the massUpdate method defined by the frmPersistentObject. It checks update right for each object using common object method. If and object follows the AyMINE framework implementation rules, there is not necessary to implement any functionality except the clip. However if some field update requires special right control, the massUpdate method should be overwritten by the object implementation.

Steps to support multi-update functionality

The functionality shall be defined for each object individually. It requires:

  • Defined object-related clip for multi-update. The recommended clip name is massUpdate
  • Set the method to the object list that calls the clip

And that's all.

Multi-update implementation example

Example is from the task object definition:

The massUpdate clip definition:

"massUpdate":{ 
   "parameters":{ 
      "clipParams":{ 
         "useParentData":true,    // Clip does not load any data from server
         "closeButton":false,     // Close button is at the bottom of the dialog
         "closeEmpty":false       // Shall be defined! – There are no data at start
      } 
   },
   // Do not change tiel 
   // The labels are generally defined but object-related text is also possible
   "title":{ 
      "h3":"lang.get('msg_MassUpdate')",
      "note1":"lang.get('msg_MassUpdateDesc')"
   },
   // Clear data sent from the list – without that clip fill data from the first selected object
   "methods":{
      "origAreaID":"obj.tskAreaID",
      "tskAreaID":0,
      "responsibleID":0,
      "dtPlanStart":null,    
      "dtPlanEnd":null
   },
   // Set fields for all object fields that support multi-update
   // Be careful that multi-update should not break the related functionality (check warnings sections for details)
   "active":{
      "attr1":{
         "tskAreaID":{ "required":false, "default":false },
         "responsibleID":{ "required":false, "default":false,  
            "where":"=`sysUserID in (select sysUserID from tskwUserActiveAreas where tskAreaID = ${obj.origAreaID})`" 
         },
         "priority":{"type":"meter", "required":false },
         "dtPlanStart":{ "type":"date", 
            "counterpart":"dtPlanEnd", "margin":"bottom", "label":"dPlanned", "required":false
         },
         "dtPlanEnd":{ "type":"date", "counterpart":"dtPlanStart", "margin":"up", "required":false},
         "timeExpectedMin":{ "counterpart":"timeExpectedMax", "margin":"bottom", 
            "label":"timeExpected", "short":true, 
            "visible":"=!user.hasModuleOption('sys','SIM')", "required":false 
         },
         "timeExpectedMax":{ 
            "counterpart":"timeExpectedMin", "margin":"up", "short":true, 
            "visible":"=!user.hasModuleOption('sys','SIM')", "required":false 
         },
         "complete":{ "required":false }
      }
   },
   "pageButtons":["saveClose", "close"],
   // Call common meethod defined by the persistent object
   "update":"server.this.massUpdate"
}

The massUpdate operation shall be supported by the list:

"listView":{
   . . .  
   "operations":{
      // for massUpdate is the default icon supported by framework
      "massUpdate":{ 
         "uright":"frm@frmPowerUser",   // overrides default system right
         "a":"form.this.clip.massUpdate" 
      }
   },
   "buttons":[ "massUpdate" ]
}

What is the framework functionality for multi-update

The framework implements:

  • Common massUpdate method for update
  • Support to clear values from the loaded object (using the clip methods)
  • Default method icon directly defined by application (do not override, linked with the massUpdate list operation name)
  • Dialog-specific css style formatting the massUpdate differently than other common dialogs (linked with the massUpdate clip name)
  • Default system rights required for the massUpdate operation ( frm@frmPowerUser system rights)

Warnings about the functionality

Be careful about the side-effects that the multi-update can cause

Multi-update can go around the default functionality

The default multi-update method makes direct object update. It does not call the optional postOp defined by the object. If some business functionality is defined by postOp, it won't be called after the multiple object update.

The problem example: post update can generate a message or call some linked object changes. Such functionality won't be called if the update is made by multiple object update.

There are two possible solutions:

  • Make object-specific massUpdate (just overwrite the default method)
  • Don't allow changes that requires additional calls

The 2nd approach is used by many object where some bulk updates are made by separate operations. E.g. task assignment to another person is a standalone operation that changes the assigned person (the example above contains the massUpdate clip that allows changing task responsible person but not assigned person).

User rights control

Some changes require specific user rights. Typically, the status change is limited to some persons or additional conditions.

The control of the rights according to the object status shall be implemented in the object-specific checkRightsInt method.