How to addValidationTasks to all places where you can edit data

There is a nice write-up for using addValidateTasks https://support.sugarcrm.com/documentation/sugar_developer/sugar_developer_guide_14.0/cookbook/adding_field_validation_to_the_record_view/.

However, as Sugar evolves there are more and more places where data can be edited.

  • create
  • record
  • list
  • preview
  • record view dashlets
  • sub-panels list view
  • tileview
  • etc

If we want to enforce data validation how do we create validation that can span all available views?

 /CC    

Parents Reply
  • Hi  ,

    Unfortunately we don't have any official documentation to this "hidden feature" of Sugar.

    It is supposed to be as simple as throwing an exception in your logic hook before_save. 

    Make sure it is not "Throwable" which will be catched and logged in sugarcrm.log instead.

    ====

    Also, I apologies, we have backported to 13.1/2/3 and it is also available on 14.0 the fix for propagating the exception to the UI.

    You can take a look at include/utils/LogicHook.php on method public function process_hooks($hookArray, $event, $arguments).... 

    SugarCRM | Principal Developer Advocate

Children
No Data