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
ArupArup 

VALIDATION RULE ERROR IN VLOOKUP

Hi All,

 

I want to access Approval_From__c field(picklist) of Proposal_Approval__c Object(Custom) and want to validate the result of VLOOKUP with a text "Demand" through ISPICKVAL method. So I have wrritten the below validation rule. (Demand_Approval__c is a custom field in the QUOTE object)

 

AND(ISPICKVAL(VLOOKUP($ObjectType.Proposal_Approval__c.Fields.Approval_From__c,$ObjectType.Proposal_Approval__c.Fields.Name,Name), 'Demand'), (PRIORVALUE(Demand_Approval__c) = TRUE))

But system is showing an error as "Error: Incorrect parameter for function 'ISPICKVAL()'. Expected Picklist, received Text".
Any solution to this problem would be appreciated.
Thanks in advance.
jhurstjhurst

Since the rfeturn value from a VLOOKUP is a Text value, you do not need to use ISPICKVAL.  You should be able to use just an equals:

 

AND((VLOOKUP($ObjectType.Proposal_Approval__c.Fields.Approval_From__c,$ObjectType.Proposal_Approval__c.Fields.Name,Name) == 'Demand'), (PRIORVALUE(Demand_Approval__c) = TRUE))

 

Hope this helps

 

Jay

Avishek.royAvishek.roy

I have tried the code without ISPICKVAL(). But the system is showing-


"Error: Field $ObjectType.Proposal_Approval__c.Fields.Approval_From__c is a picklist field. Picklist fields are only supported in certain functions"

 

Any further comment or idea is welcome.

jhurstjhurst

Sorry for the confusion.

 

Per the documentation on the VLOOKUP Function:

 

  • The field_to_return must be an auto number, roll-up summary, lookup relationship, master-detail relationship, checkbox, date, date/time, email, number, percent, phone, picklist, text, text area, or URL field type.

You wil not be able to return a Picklist value.

GuyClairboisGuyClairbois

The field_to_return must be an auto number, roll-up summary, lookup relationship, master-detail relationship, checkbox, date, date/time, email, number, percent, phone, picklist, text, text area, or URL field type.

 

So the manual appears to contain an error?

jhurstjhurst

Yes,

 

There is a documentation error that we are working to get fixed.  Thanks for the follow up (I have also edited my previous post to reflect that the picklist option should be removed from the docs).

 

Jay