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
mathewsmathews 

wildcard with ISPICKVAL

HI All,

            Is it possible to use wildcard with ISPICKVAL in a workflow formula field ?

 

ex.  SPICKVAL(TargetX_Events__OrgEvent__r.TargetX_Events__type__c, "%Chat").

 

if not is there any workaround for this

 

Thanks

 

Abey

 

 

Best Answer chosen by Admin (Salesforce Developers) 
Steve :-/Steve :-/

Okay for that you cannot use the CONTAINS function (at least nor directly).  What you'll need to do is create a custom Formula(Text) field.  

The Formula(Text) field  will be:

TEXT(PicklistField)

Then in your WFR your criteria formula will be something like:

 

 

AND(CONTAINS(OrgEvent__r.Formula_Text__c, "Chat"), Mode__c =1)

 

 

 

 

 

All Answers

Steve :-/Steve :-/

Not a true wildcard like * or % but you can use INCLUDES or CONTAINS

Steve :-/Steve :-/

.

.

.



.

 

CONTAINS

Description:Compares two arguments of text and returns TRUE if the first argument contains the second argument. If not, returns FALSE.
Use:CONTAINS(text, compare_text)and replace text with the text that contains the value of compare_text.
Example:
IF(CONTAINS(Product_Type__c, "part"), "Parts", "Service")

This formula checks the content of a custom text field named Product_Type and returns “Parts” for any product with the word “part” in it. Otherwise, it returns “Service.” Note that the values are case sensitive, so if a Product_Type field contains the text “Part” or “PART,” this formula returns “Services.”

Tips:
  • This function is case sensitive so be sure your compare_text value has the correct capitalization.
  • When using this function in a validation rule or workflow rule, fields that are blank are considered valid. For example, if you have a validation rule that tests to see if the serial number of an asset contains “A,” all assets that have a blank serial number are considered valid.
  • The CONTAINS function does not support multi-select picklists. Use INCLUDES to see if a multi-select picklist has a specific value.

 

 



INCLUDES

Description:Determines if any value selected in a multi-select picklist field equals a text literal you specify.
Use:INCLUDES(multiselect_picklist_field, text_literal)and replace multiselect_picklist_field with the merge field name for the multi-select picklist; and replace text_literal with the multi-select picklist value you want to match in quotes.
Examples:INCLUDES(Hobbies__c, "Golf")returns TRUE if one of the selected values in the Hobbies custom multi-select picklist field is Golf.
Tips:
  • 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.
  • Salesforcereturns an error if any of the following occurs:
    • You do not provide a text_literal expression.
    • You provide an empty text_literalexpression, such as""or" ".
  • Use ISNULL to determine if a multi-select picklist field is empty.
  • Use the PRIORVALUE function inside the INCLUDESfunction to check if the previous value of a multi-select picklist field included a specific value. For example:
    INCLUDES(
       PRIORVALUE(multiselect_picklist_field),text_literal
    )

BEGINS

Description:Determines if text begins with specific characters and returns TRUE if it does. Returns FALSE if it does not.
Use:BEGINS(text, compare_text)and replace text, compare_text with the characters or fields you want to compare.
Example:IF(BEGINS (Product_type__c, "ICU"), "Medical", "Technical")

This example returns the text “Medical” if the text in any Product Type custom text field begins with “ICU.” For all other products, it displays “Technical.”

Tips:
  • This function is case sensitive so be sure your compare_text value has the correct capitalization.
  • When using this function in a validation rule or workflow rule, fields that are blank are considered valid. For example, if you have a validation rule that tests to see if the serial number of an asset begins with “3,” all assets that have a blank serial number are considered valid.
mathewsmathews

I am trying to use a Picklists value field in a work flow Rule.

Shashikant SharmaShashikant Sharma

Not possible to use wild card at maximum you can do this

 

Take this example we have a pick list which has three options

Active , InActive and Other and I want to write a formula to check both Active and InActive

CONTAINS( 
                      IF(
                           ISPICKVAL(Active__c , 'Active') , 'Active' ,  
                                  IF(
                                       ISPICKVAL(Active__c , 'InActive')  , 'InActive' , 'Pending'
                                      )
                           )    
                   , 'Active')

 This Will give true if selected value is Active or InActive

Steve :-/Steve :-/

Hi Abey,

 

Can you post an example of the WFR Formula as it is currently written?  Have you trying changeing it to use INCLUDES or CONTAINS functions like the ones I posted?

mathewsmathews

Hi Stevemo,

                     here is the formula .

 

AND(SPICKVAL(OrgEvent__r.type__c, "Online Chat"),Mode__c =1)

 

 I am looking for something which work  as follows

 

AND(SPICKVAL(OrgEvent__r.type__c, "%Chat%"),Mode__c =1)

Steve :-/Steve :-/

Okay for that you cannot use the CONTAINS function (at least nor directly).  What you'll need to do is create a custom Formula(Text) field.  

The Formula(Text) field  will be:

TEXT(PicklistField)

Then in your WFR your criteria formula will be something like:

 

 

AND(CONTAINS(OrgEvent__r.Formula_Text__c, "Chat"), Mode__c =1)

 

 

 

 

 

This was selected as the best answer
Steve :-/Steve :-/

Hi Abey,

 

Are you all set with this or do you still need help?  

 

Cheers,

 

SteveMo

mathewsmathews

it works.Thanks Stevemo

 

Abey



Steve :-/Steve :-/

That's 2 beers you owe me!!! ;-p

mathewsmathews

no ,Just 1 beer. You said it's   2 for 1 sale Today :)

 

Steve :-/Steve :-/

**bleep** it!!!  ;-p