Hi,
I have a code like below where I am getting a list of text strings into a local!leadIDs. When I try to use contains() function to check whether a specified string exists, then I am getting an error like
Expression evaluation error at function 'contains' [line 11]: Invalid types, can only act on data of the same type (Any Type, Text)
Can someone advise, how to fix this.
a!localVariables( local!leadIDs: index( rule!getLeads(key: null()), "id", null()), contains(local!leadIDs, "AB12345"))
Discussion posts and replies are publicly visible
contains() is finnicky about data types - you should try the following:
contains( touniformstring(local!leadIds), "ABCDEFG" /* etc */ )
This will force-cast "local!leadIDs" to "array of string" type instead of "array of any type", and will not trip up contains().
That was a HUGE help. I have been struggling immensely with how picky contains is with the types. I have been doing casting, until I stumbled upon a situation in which something simply refused to cast to an array of text. This solved by problem, bypassing the need to cast.