+ Start a Discussion
raju123raju123 

Childrens exist or not through validation

Hi,

 

     Let us suppose i have two objects(A,B) with look up relationship. A is parent and B is child.  

 

 

Now i want to write a validation that if A doesn't have childrens give an error message.

 

I am trying the following in "A" Object but its not working

 

 A's  Id<> $ObjectType.B.Fields.A__c  

 

 

Can any body help me Please please........................ How Can i Know Childrens exist or not through validation.

 

 

If above is not correct what is the significance of $ObjectType. please help me

raju123raju123

Please can any body give me reply for above request

SteveMo__cSteveMo__c

You can do it with a VR if the records have Master-Detail relationship (not a Parent-Child).  If they have an M-D relationship you can create a Roll-Up Summary (RUS) field on the Master object that counts the number of Derail records.  Then add a VR with an error if the count is < 1 like this.

AND(
NOT(ISNEW()),
RUS_DetailCount < 1)

 

raju123raju123

Thank you for you reply

 

But my relationship is look up.how can i do this for look up


Stevemo wrote:

You can do it with a VR if the records have Master-Detail relationship (not a Parent-Child).  If they have an M-D relationship you can create a Roll-Up Summary (RUS) field on the Master object that counts the number of Derail records.  Then add a VR with an error if the count is < 1 like this.

AND(
NOT(ISNEW()),
RUS_DetailCount < 1)