Product Administration Guide > Creating Validation Rules for Customizable Products > About Creating Custom Rule Checkers >

PreValidate Method


The PreValidate method determines the list of fields and attributes that the rules checker requires and returns them to the Compound Product Validation Engine. It may optionally use the product Id to retrieve product specific data related to the rule, or other parameters that may influence the list of fields and attributes.

Example

The Port Over-Subscription Checker business service checks that the sum of the bandwidths of the connections going into or out of a node does not exceed the bandwidth of the node. The checker has two parameters that specify the name of the Bandwidth attribute of the Node product and the name of the bandwidth of the Connection product. The rules checker requires the Network Element Type, Product Name, Node and To Node fields and the Bandwidth attributes to evaluate the rule. The method returns a property set of type Field and a property set of type Attribute containing the list of fields and attributes required by the rules checker.

NOTE:  This sample code is provided for instructional purposes only. Different code may be needed, depending on how your application is configured. This sample script contains some fields that may not be present in your application, because they are only available in Siebel Industry Applications.

function PreValidate (Inputs, Outputs)

{

// Retrieve input arguments

var productId = Inputs.GetProperty("Product Id");

var parameter;

// Retrieve the rules checker specific parameters

// These parameter

for (var i = 0; i < Inputs.GetChildCount(); i++)

{

var child = Inputs.GetChild(i);

switch (child.GetType())

{

case 'Parameter':

parameter = child;

break;

default:

throw "Unknown argument: " + child.GetType();

break;

}

}

if (parameter == undefined)

{

throw "Missing input argument 'Parameter'";

}

var connectionAttrib = parameter.GetProperty("Connection Attribute");

var nodeAttrib = parameter.GetProperty("Node Attribute");

// Define the fields used by this rules checker

var field = TheApplication().NewPropertySet();

field.SetType("Field");

field.SetProperty("Network Element Type", "");

field.SetProperty("Product Name", "");

field.SetProperty("Node", "");

field.SetProperty("To Node", "");

// Define the attributes used by this rules checker

var attribute = TheApplication().NewPropertySet();

attribute.SetType("Attribute");

attribute.SetProperty(connectionAttrib, "");

attribute.SetProperty(nodeAttrib, "");

// Return the required fields and attributes

Outputs.AddChild(attribute);

Outputs.AddChild(field);

}

Related Topics

Validate Method.

Product Administration Guide Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Legal Notices.