Backoffice Customization – Cockpit integration strategy and Exception Handling

Backoffice Customization – Cockpit integration strategy and Exception Handling

Defining Constraints –

Validation Constraints

backoffice-customization-blog-by-sapours

The SAP Commerce Administration Cockpit enables you to create different types of constraints for Data Validation. You may also create groups of constraints to validate data with multiple constraints in one invocation.

The available constraints include:

— Attribute constraint

— Type constraint

Validation constraints or constraints are basically defined on mandatory attributes. The attributes which are mandatory are defined with constraints.

Example We have defined new  MyProduct item type. With below attributes
Attributes :-
code  *
ean*
manufacturerName*
defaultCategory*
user*

summary
onlineTo
onlineFrom
onlineDays
galleryImages
soldIndividually
numberOfReviews
averageRating
supplierAlternativeAID
buyerIDS
manufacturerAID

Attributes defined in red are  defined mandatory in items.xml

Validations in the BackOffice:

Here we have defined constraint for code, ean, manufacturer name, user. Active Constraint will show corresponding field in red highlighted color by default in Backoffice in case we have not provided any values for them.

Validation messages will be populated as shown in the below  screenshot.

If we click next without filling values for fields –  error messages will appear.

Once we enter the value for field , constraint will be disabled.

As Follows –

We can have three different severity for the constraint as –

1) ERROR – will be visible in red color in backoffice

2) WARN – will be visible in orange color in backoffice

3) INFO- will be visible in blue color in backoffice

Constraints  with  Severity –

— ERROR – will be visible in red color

Value must be entered for corresponding field. Then only it will be disabled.

— WARN – will be visible in orange color

Value for this constraint can be skipped but user has to confirm if  he wishes so.

 

OOB Product type also  has following warning validation.

— INFO- will be visible in blue color

Value for this constraint can be skipped but user has to confirm if  he wishes so.

Localizing the Validation Messages

These error messages can be localized. We need to put the messages in impexes for each locale.

Backoffice Roles :

Validation constraints are defined through impexes. These are associated with backoffice role. That means these constraints can be defined  specific to roles.

We have used  constraint group for constraints that is – defaultBackofficeValidationGroup

 

We have used  Not Empty Constraints for Product.

Not Empty – to check String values not Empty.

Not Null – to check the Reference to other type.

Example impexes – with localized  messages.

Once you run  these Impex files for constraints you need to reload the validation engine  from BackOffice.

GO To >

System -> Validation -> Constraints –

Need to click “Reload” icon indicated below for reloading the validation engine.