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
ArunForceArunForce 

Validation rules-comparing the field from one custom object with another custom object field

Hi all,
I am having two custom objects which is named as custom_object1__c,custom_object2__c.I want to write the validation rule on custom_object1__c saying that "custom_object1__c.transactiondate should be always greater than custom_object2__c.somedate".

I have written the validation rule like this.
transactiondate__c < custom_object2__c.somedate__c

I am getting the following error.
Error: Syntax error. Found 'custom_object2__c'

how can i write the rule for this scenario.
please help me to solve this.

thanks,
Arun.

Prady01Prady01

Hi there, You can make the validation rule on the Custom object1 if this is a child . i.e tansactiondate.Custom object2 < tansactiondate.Custom object1.

 

  You can get the parent fileds from the relationship but this is obtained on the child but not on the parent object.

 

 

Hope this helps!

Prady

ArunForceArunForce

Hi Prady,

thanks for your reply.But I dont have lookup or parent-child reference between those two objects..What can i do?Is there anyother alternatives?

 

thanks,

Arun

MarcPannenberg.ax1843MarcPannenberg.ax1843

If there is no relationship between the two objects, then there is no relationship between records of those objects. How do you know which records to compare?

 

Are you sure there is no lookup?

AdrianCCAdrianCC

Hi,

 

It might work with VLOOKUP. http://www.salesforce.com/us/developer/docs/pages/Content/pages_variables_functions.htm

 

Returns a value by looking up a related value on a custom object similar to theVLOOKUP() Excel function. VLOOKUP(field_to_return, field_on_lookup_object,lookup_value) and replace field_to_return with the field that contains the value you want returned, field_on_lookup_object with the field on the related object that contains the value you want to match, and lookup_value with the value you want to match.

 

I think you'll need individual unique records for the custom object on which you're doing the compare

 

Thanks,

Adrian