2

enter image description here"Open" Outcome conditions Does Require Record Changed to meet criteria: true {!contactsStageText} ([Open]) Contains Open Skipped this outcome because its conditions weren't met:

EDIT: contactsStageText was text previously, later changed to Picklist collection variable to match to the record type to update. Now all the collection variable and variables going to the decision element are picklist variable. I am using contains in decision element to see if the collection picklist variable contains "Opt-out" first and others later.

I think this debug of flow says it all, but I am not sure why would it happen as I am using contains to see if the collection variable contain Open or not but, debug shows even though there was open in collection variable this decision path was skipped. What am I doing wrong here?enter image description here Overall flow looks like this. enter image description here

7
  • 1
    Can you add detail of the collection variable and how it is populated, plus the condition element please? Screenshots would be adequate.
    – Phil W
    Nov 24, 2021 at 7:18
  • I hope the Screenshots will help to diagnose what I might have done wrong just to get default outcome.
    – tough
    Nov 24, 2021 at 8:35
  • What is the type for "contactstage"? Please edit to add this detail. Is it a picklist?
    – Phil W
    Nov 24, 2021 at 8:52
  • I suspect it is because you are testing a string value against a picklist value. Look at this unofficialsf.com resource.
    – Phil W
    Nov 24, 2021 at 9:12
  • I had also tried with string, but I will try again, thank you @PhilW for the suggestion and help.
    – tough
    Nov 24, 2021 at 10:05

1 Answer 1

6

tl;dr

Do one of the following:

  • Use a Text Collection and not a Picklist Collection for your accountstagecollection. Continue to ADD your contactstage value as you are doing, then later in your Decision element you will be comparing the same data types.
  • Create some single Picklist type variables - one for each possible picklist value. Assign the appropriate value to them (e.g., picklistVariable_Optout EQUALS Opt-out), then use those as the Value in each of your Decision element Outcome comparisons (e.g., accountstagecollection CONTAINS picklistVariable_Optout).

This intrigued me greatly, so I set up a test Flow (which I would be happy to share...somehow) to attempt to cover as many options that I could think of.

  • A Text field and a Picklist field were added to the Account object.
  • Picklist values were Open, Opt-out and Demo Booked.
  • On an individual Account record, I added the same value in the Text field as I chose for the Picklist field. (E.g., for Record 1 both new fields had the value of "Open", for Record 2 they both were "Opt-out")
  • In the Flow, all of the Account records were retrieved, looped through, and the values of these two fields added to Flow Variables as follows:
Value from this field Into this type Flow variable Variable name
Text Text Collection textFromTextCollection
Picklist Collection picklistFromTextCollection
Text Single textSingle
Picklist Text Collection textFromPicklistCollection
Picklist Collection picklistFromPicklistCollection
Picklist Single picklistSingle

The single variables were a curiosity - as I ADDed to them in each loop, thus creating one long, continuous string.

  • Next, successive Decision elements were placed to parse the various Collections and compare them in different ways

    1. textFromTextCollection CONTAINS text

      enter image description here

    2. picklistFromTextCollection CONTAINS text

      enter image description here

    3. textFromPicklistCollection CONTAINS text

      enter image description here

    4. picklistFromPicklistCollection CONTAINS text

      enter image description here

    Numbers 1 and 3 - where the Collection variable was Text type - worked by following the correct Outcome.

    Numbers 2 and 4 - where the Collection variable was Picklist type - did NOT work and they followed the "Default" Outcome.

    1. textSingle CONTAINS text

      enter image description here

    2. picklistSingle CONTAINS text

      enter image description here

    Curiously, both of these worked by following the correct Outcome path.


Finally (probably should have started here) I looked in Salesforce Help > Docs > Automate Your Business Processes > Flow Operators in Decision and Pause Elements:

Collection

Check whether a Collection resource's value contains or matches another value or resource.

Operator True if... Supported Data Types
Contains An item in the collection that's selected for Resource contains the exact same value as Value Resource of the same data type.

Picklist

Check whether a Picklist resource's value matches or contains another value or resource.

NOTE: These operators treat the resource’s value as a text value.

Operator True if... Supported Data Types
Contains The value for Resource contains what's entered or selected for Value - Picklist is included in a long list of data types
For example, if the value of {!varPicklist} is yellow-green, the condition {!varPicklist} Contains green evaluates to true

The results of the test Flow match exactly with the documentation:

  • When the Collection was of Text type and compared directly to text typed into the Value box, it worked.
  • When the Collection was of Picklist type and compared directly to text typed into the Value box, it did NOT work.
  • When the Single (non-Collection) variable was of either type and compared directly to text typed into the Value box, it worked.

So in order to test this further, I created three Picklist single variables to use essentially as constants (you cannot create a Flow Constant of Picklist type). A new first element in the Flow set these variables:

Variable Value
picklistVariable_Open Open
picklistVariable_Optout Opt-out
picklistVariable_DemoBooked Demo Booked

Screenshot: enter image description here

Next I added a Decision element to compare one of the Picklist Collection variables to the new Picklist single "constant" variables:

  • picklistFromPicklistCollection CONTAINS picklist Single variable

    enter image description here

...it worked!


EDIT

I just re-read your chat discussion with @PhilW and discovered something you said that did not register with me the first time I read it:

[A]t the start of decision as well as at the end I have Picklist record types in the middle while making decision I need to convert collection picklist variable to Text data just to decide and later update picklist from that decision. I now find trapped...

So in your specific case I would suggest the second option above - especially since it is Record Types and thus is a restricted Picklist, thus making it easy to create a Flow Picklist variable for each possible value.

1
  • Thank you @Moonpie for your detailed explanation and lots of effort you have put to explain. I am sincerely thankful to your generosity and helpfulness. I will put myself to test this for myself and get better understanding. I am so happy that we have a community to help each other.
    – tough
    Dec 7, 2021 at 12:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .