I have a rollup summary field which just calculates sum of weights from child records and I am trying to apply a validation rule that if IsActive = true && Sum_of_Weights != 100 then throw an error. Because child weights can be entered more or less than 100 when parent is inactive but once it’s active, weight sum must be 100.
It gives me an error even on positive condition when parent is active and sum is 100 and it’s not letting me edit parent record.
Any suggestions?
Best Answer
This objective does not make sense to me unless the intent is to prevent marking the parent object as Active until
Sum_of_Weights__c
equals 100. If this is the case, you can include anISCHANGED()
function in your formula:Then your validation will only go off if a parent object is moved from
IsActive__c = false
toIsActive__c = true
withoutSum_of_Weights__c
being 100.You may also need a validation rule on the child object to prevent children from being added or removed from an Active parent.