I have a requirement -

  1. Create a multiselect picklist field on account Named - Area and add to the page layout

  2. There is a field on opportunity called pricebook and it is a lookup to Pricebook object.

NOT CONTAINS(TEXT (Area__c),Opportunity.Pricebook__r.Name)

Then Create a validation rule -

Pricebook custom field

TEXT (Area__c) <> Opportunity.Pricebook__r.Name

Error message: "You must select a pricebook that matches the Pricebook field on the related Account record."

I tried and it gives me an error - Error: Incorrect parameter type for function 'INCLUDES()'. Expected Text Literal, received Text.

I go through with the this document, is there a way i can create a validation rule?

The client doesn't want to use a trigger.

Is there a way to compare values of multi-select picklist with another text field?

Please suggest !!

  • Ravina, I don't see where you've used the INCLUDES function in your formula. Could you double-check your post? – Shane Steinfeld Sep 16 '18 at 3:49

As you have already observed the error, multi-select picklists can only work with certain type of formula functions and that for INCLUDE function, it always expects a Text Literal.

The text_literal expression must be of type text and enclosed in quotes. It cannot be a merge field or the result of a function.

With such limitations, I will rather recommend to use a trigger here.

From client perspective, it does not really makes any difference to an end user as how a validation is being implemented. As far as its from an admin perspective, sometimes you just cannot go through configuration route and that's why we have the customization framework available. With proper documentation even in case of customization, an admin can still make minor changes in triggers/apex classes. With Salesforce's current offerings, its really very hard to imagine a fully configuration developer vs. a customization developer, there's always a blend.

Having said that, you should definitely try to make a business use case as why you cannot use configuration here and why customization is required. That's how you have to deal with limitations across the platform.


As @Jayant said, there isn't a function (yet) that will let you compare a multi-select picklist value with anything but a text literal.

I'd probably go with a trigger here as well; however, if you don't have too many pricebooks and don't anticipate creating pricebooks too frequently, you could do it with a validation rule:

  Opportunity.Pricebook__r.Name = "Pricebook_A" && INCLUDES(Area__c, "Pricebook_A") ||
  Opportunity.Pricebook__r.Name = "Pricebook_B" && INCLUDES(Area__c, "Pricebook_B") ||
  Opportunity.Pricebook__r.Name = "Pricebook_C" && INCLUDES(Area__c, "Pricebook_C")
  ,false, true

Again, I wouldn't go this route unless there are just a handful of pricebooks, but...it's do-able.

  • Ravina, how did you wind up solving for this? – Shane Steinfeld Sep 30 '18 at 21:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy