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
Micky MMicky M 

Validation Rule

Hi All,

I dont know if this is possible, i have a list of objects (line items) that im displaying on a vf page allowing the user to add new objects and what i need to do is ensure the a quantity on the newly added object matches a quantity on the parent object. Does anyone know if i can do this using a validation rule rather that a trigger?

So i have:

Parent Object Quantity 54
    line item 1 Quantity 0
    line item 2 Quantity 45
    line item 3 Quantity 54

so if line item 3 is the new obect and i need to test if this quanitity is the same as the parent quantity how would i do that with a validation rule .. if i can.

Is it not just something like (using Opportunity Line Item as an example):
Opportunity.Quantity__c <>  Quantity

If you are using custom objects it would be something like:
Parent__r.Quantity__c <> Quantity__c