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
EUSEUS 

Validation rule using $ObjectType and Picklist field ....

Hi,

 

I am using a validation rule to check that a picklist selection does not match an sObject field (which also is a picklist field).

 

Here is the formula I am using:

 

(ISPICKVAL(Language__c,'English')   &&  $ObjectType.SetUp__c.Fields.Msgs_Lang__c = 'English')

 

The error message is not triggered so I checked and the problem is with the object  $ObjectType.SetUp__c.Fields.Msgs_Lang__c which is not returning its true value (the problem might be it is a picklist field).

I tried with VLOOKUP instead, however it does not support  picklist fields.

 

Any suggestions as to how could I compare a picklist selection to an other custom field on other sObject?

 

Thanks a lot!

Sonam_SFDCSonam_SFDC

Hi,

 

I testted with the similar  validation which seems to be working fine if the format is as follows..

 

ISPICKVAL(Language__c,'English') &&  ISPICKVAL( $ObjectType.SetUp__c.Fields.Msgs_Lang__c = 'English')

 

However, you have to make sure there is a relation between the two objects and that you create a validation for each value of the picklist.

 

 

EUSEUS
Thanks for your answer. However, the two tables do not have any
relationship.. I tried anyways but didn t work.



Regards,
Neeraj MendheNeeraj Mendhe
@Sonam_SFDC

I tried the validation you mentioned but getting an Error -

Error: Incorrect parameter type for function 'ISPICKVAL()'. Expected Picklist, received Object

in my case I ensured that Cross Object Field is Picklist though i am getting an error while attempting a validation rule.

You got any Solution..?

Thanks