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
uzairuzair 

how to use a field in validation from other object that does not have relation

Hi All,

 

How to use a field in validation from other object that does not have relation in between.

The StageName and Renewal are from 'Opportunity' and Details_Required_for_Renewals__c is from the object 'Product'.

There is no relationship in between the Opportunity and Product objects(means no lookup or masterdetail field is created)

 

I wrote the formula as given:

AND(
           Renewal__c="", 
           OR(  ISPICKVAL( StageName, "Signed contract received"),
                    ISPICKVAL( StageName, "Closed Won")),
           $ObjectType.Product__c.Fields.Details_Required_for_Renewals__c, "FALSE"
 )

when i'm clicking check for syntax i'm getting the following error

" Incorrect parameter for function AND(). Expected Boolean, received Object "

 

any help to overcome this error will be appreciated.

 

Thanks in Advance.

Pradeep_NavatarPradeep_Navatar

No, you can use only related object’s field and fields of current object in validation. And to use other object’s field without relationship doesn’t make sense.

tantotanto

To use another object with out relationship you would have to use Apex.

rao6308rao6308

You can achieve this using a trigger.

Give me the exact scenario and all the If's and but's I will help you with the trigger.