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,

    We usually do our validation in the field level so it triggers across all views (maybe not all but it covers the typical views like list/record/subpanel). For instance, if we do validation on a dropdown we do the validation task in custom/modules/Accounts/clients/base/fields/enum/enum.js

Reply
  • Hi,

    We usually do our validation in the field level so it triggers across all views (maybe not all but it covers the typical views like list/record/subpanel). For instance, if we do validation on a dropdown we do the validation task in custom/modules/Accounts/clients/base/fields/enum/enum.js

Children
  • Hi   and thank you for your feedback,

    in our scenario, the required control is more complicated and required to evaluate condition on multiple fields but also other records.

    So it's seems complicated to got a control only at a field level.

    Fred

  • Use Case 1:

    When an Opportunities Sales Stage is changed to Closed Won, we require that at least one Contact be associated to the Opportunity.