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
  • Hi  ,

    Great minds think alike !!! I was about to post a question about the same thing.

    We are facing the same issue when we want to return an error to the end user before a save, without having to think of ALL the context this save can be done.

       and  , this is really an important concern for your dev partners that should be handle with a straightforward solution that is upgradesafe.

    nb : we were using this trick ( throw an exception in a before save that was interupting the save Can a 'before' logic hook stop processing a bean ) before the 13.0.3 upgrade that disabled this feature

  • Hi   ,

    I had a chat with Engineering and our official answer is, as of today, you'd have to implement your validations per view as per the article Jeff has referenced here. You could also leverage, Dependency actions that can be used to set "validations". Like ReadOnly, SetVisibility, SetRequired. All these can be configured to be triggered on a formula.

    A logic hook is also an alternative with the drawbacks of the UI elements that you'd get with the view validations. 
    We had an issue introduced as part of our PHP8.2 work that was preventing the exception to be propagated to the UI, but that has been fixed and backported to all SugarCloud instances as well as 13.0.4 versions.

    SugarCRM | Principal Developer Advocate

Reply
  • Hi   ,

    I had a chat with Engineering and our official answer is, as of today, you'd have to implement your validations per view as per the article Jeff has referenced here. You could also leverage, Dependency actions that can be used to set "validations". Like ReadOnly, SetVisibility, SetRequired. All these can be configured to be triggered on a formula.

    A logic hook is also an alternative with the drawbacks of the UI elements that you'd get with the view validations. 
    We had an issue introduced as part of our PHP8.2 work that was preventing the exception to be propagated to the UI, but that has been fixed and backported to all SugarCloud instances as well as 13.0.4 versions.

    SugarCRM | Principal Developer Advocate

Children