Removing a validation rule

You can remove a validation rule from the Management Center user interface. For example, you can change a required field into an optional field.

Procedure

  1. Open HCL Commerce Developer and switch to the Enterprise Explorer view.
  2. Expand LOBTools > WebContent > WEB-INF > src > xml > commerce > component > objectDefinitions, where component is the name of the Management Center component.
  3. Open the object definition file that includes the validation rule that you want to remove.
  4. Locate and delete the validation rule from the object definition. Validation rules can be specified in three ways, which are removed differently.
    • A validation rule can be specified by including one of the following property definition attributes:
      • maximumSize
      • maxValue
      • minValue
      • required
      • type
      To remove these types of validation rules, delete the attribute from the property definition.
    • A validation rule can be specified by declaring a definition element that extends the validator definition as a child element of a PropertyDefinition element. To remove this type of validation rule, delete the validator declaration. For example, in the following code snippet the code <NoSpacesValidator package="ext"/> must be deleted to remove the validation rule.
      
      <PropertyDefinition
         displayName="${catalogResources.categoryCode_DisplayName}"
         propertyName="identifier" type="string" required="true" maximumSize="254">
         <NoSpacesValidator package="ext"/>
      </PropertyDefinition> 
    • A validation rule can also be specified by declaring a definition element that extends the Validator class definition as a child element of an object definition. To remove this type of validation rule, delete the validator declaration. For example, in the following code snippet, the code element UniqueValueForChildObjectPropertyValidator that has the definition name "cmc/catalog/OfferPriceMinimumQuantityUniquenessValidator" must be deleted to remove the validation rule.
      
      <Definitions>
      <ReferenceObjectDefinition copyProtected="false" definitionName="cmc/catalog/BaseAttachmentReference" 
       displayName="${catalogResources.catalogAttachmentReference_DisplayName}" idProperty="attachmentRefId" 
       isBaseDefinition="true">
      ...
        <!--- This is a validator definition to validate that the minimum quantity values for offer prices are unique. -->
        <UniqueValueForChildObjectPropertyValidator 
        definitionName="cmc/catalog/OfferPriceMinimumQuantityUniquenessValidator" 
        errorMessage="${catalogResources.offerPriceMinimumQuantityUniquenessWarning}" objectPath="CatalogEntryOffer" 
        propertyName="minimumQuantity" validatorId="offerPriceMinimumQuantityUniquenessValidator">
          <dependency localName="catalogResources" moduleName="cmc/catalog/CatalogResources"/>
        </UniqueValueForChildObjectPropertyValidator>
      ...
      </Definitions>
    1. Save and publish your changes.