function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
GregR59GregR59 

Validation rule to test if child record exists

Need to create a rule that errors if no child record has been created for parent object

 

Example

Request, and request line item

 

Request is created and is in Draft

 

User trys to change to "Submitted" but hasn't added any Request line items.

 

Errors and states "You must add line items."

shillyershillyer

If Request is a master to Request Line Item, then you can create a Roll-Up Summary field on Request that does a COUNT of Request Line Item. Then your validation rule can fire if:

 

RequestRollUp__c <= 0

 

I'm assuming RequestRollUp__c is the name of your custom Roll-Up Summary field. If that's TRUE, alert your message.

 

Hope that helps,

Sati

GregR59GregR59

Now why didn't I think of that :)

Thanks