productField Annotation

productField is a CML annotation that defines the Product2 field on a variable. productField loads the value from Product Catalog Management (PCM) during constraint model activation.

Annotationproductfield
Applicable toVariable
Value Type/ValuesLiteral (case sensitive)
DescriptionUsed to load the value from the corresponding Product2 field defined in Product Catalog Management(PCM). Defined under either a type or supertype. If defined under a supertype, the types, which inherit from the supertype, load the Product2 field value for the corresponding product. Supports a maximum of 50 Product2 fields. Loads product field values for a maximum of 20,000 products. Read-only. Doesn’t support a null value.

Example 1 

In this example, RatedPowerOutput__c is a custom field defined on the Product2 object. The constraint rules engine loads the value of RatedPowerOutput__c for the GeneratorSet product during constraint model activation.

1type GeneratorSet {
2    @(productField = "RatedPowerOutput__c")
3    int ratedPowerOutput;
4}

Example 2 

In this example, the product field variable productName is defined under a supertype EquipmentItem. Any type that inherits the supertype loads the value of Name for the corresponding product during constraint model activation.

1type EquipmentItem {
2    @(productField = "Name")
3    string productName;
4}
5
6type GeneratorSet : EquipmentItem;
7type GeneralModel : EquipmentItem;

Example 3 

In this example, the product field variable productCode is defined under the parent type GeneratorSet. GeneralModel is a child of GeneratorSet, and it can access the productCode variable from its parent by using the parent() function.

1type GeneratorSet {
2    @(productField = "ProductCode")
3    string productCode;
4
5    relation generalModels : GeneralModel[1..999999];
6}
7
8type GeneralModel {
9    string parentProductCode = parent(productCode);
10}