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
rmranjith8881.3927046400771116E12rmranjith8881.3927046400771116E12 

Update a Text field, based on Multi picklist !!!

Hello Everyone,

I have one multiple picklist field and I have a,b,c,d as values in it. And if I want to select either "a or b" OR "a and b", I would like to update one text field with "AB", if I want to select either " c or d" OR "c and d", I would like to update same text field with "CD", if I want to select all values or one value of " a or b" and "c or d", I would like to update same text field with "both".

Can we do this with workflow field update, if yes, please give me some ideas?
Thanks in advance
James LoghryJames Loghry
The simplest approach would be to use a formula field that returns AB if the picklist contains A or B (since A or B is inclusive of A and B).  The formula would look something like the following:
 
IF(
   OR(
       Include(Multipicklist__c,"a"),
       Include(Multipicklist__c,"b")
    ),
    "AB"
    ,IF(
        OR(
            Include(Multipicklist__c,"c"),
            Include(Multipicklist__c,"d")
        ),
        "CD"
        ,""
)

You might have to play with the IF / OR logic a bit depending on your exact requirment.
rmranjith8881.3927046400771116E12rmranjith8881.3927046400771116E12
Hi James,

Thanks for your reply,

Yes, it will work for displayig "AB" or "CD", but hotw about the below condition.
"If I want to select all values or one value of " a or b" and "c or d", I would like to update same text field with "both"."

I trid like this.
 
IF(
   OR(
       Include(Multipicklist__c,"a"),
       Include(Multipicklist__c,"b")
    ),
    "AB"
    ,IF(
        OR(
            Include(Multipicklist__c,"c"),
            Include(Multipicklist__c,"d")
        ),
        "CD"
        ,IF(
          AND(
             OR(
               Include(Multipicklist__c,"a"),
               Include(Multipicklist__c,"b")
              )
            ,OR(
               Include(Multipicklist__c,"c"),
               Include(Multipicklist__c,"d")
              )
            ),
             "both", ""
)))
But, it is not working as expected.

Please review the above formula, correct me if I done any thing wrong.

Thanks
Ranjith