Validation Rule that Child in ChildCollection Exists

Validation Rule that Child in ChildCollection Exists

Old forum URL: forums.lhotka.net/forums/t/10959.aspx


thaehn posted on Wednesday, December 07, 2011

Lets suppose you have a order header with line item parts.  You want to have a rule that says that at least one line item (part item to order) has to exist on the order to save the order (an order header with no line items is not valid).  What is the best way to implement a business rule for this?  Puting the rule on the parent turns the whole grid of line items red.  Puting the rule on the child collection doesn't seem to work when the collection is empty.

Todd

JonnyBee replied on Wednesday, December 07, 2011

Hi,

The rule must be on the parent object but you could

A: create a "message" field and attach the rule to that field rather than the child collection or

B: create an object level rule.

A will allow you to create a "message" field and show the error in a nicer way. Option B will have to be coded by yourself as PropertyStatus does not support object level rules.

Copyright (c) Marimer LLC