Adding server side validation - SmartPlant Foundation - IM Update 44 - Customization & Programming - Hexagon

SmartPlant Foundation Customization

Language
English
Product
SmartPlant Foundation
Search by Category
Customization & Programming
SmartPlant Foundation / SDx Version
10

One of the most powerful features of the server side customization is to change the behavior of existing SmartPlant Foundation interfaces.

This is achieved using the sideways override (known as dot one). Using .NET inheritance you just need to write a new class that inherits from the existing class. The naming is important, and the new class must be identical with ".1" appended on the end.

You have the option of calling the base method at any point in your customization. You may not want to call the base method.

In this example we add validation on the creation of a Host to ensure that the host name doesn't contain a space. If it does, we cancel the create. This is done by overriding the OnCreatingValidation method.

There are two examples of this in the server training module. The second one shows how to override the OnValidate method. Both are acceptable ways of doing it. OnCreatingValidation is called just before OnValidate, and both offer ways of canceling.