Solved

How to use Show/Hide Logic for Custom Properties using List Data Type

  • 17 August 2021
  • 2 replies
  • 856 views

Badge +3

Hi,

I was trying to make specific blocks in a template show or hide based using the condition structure:

person|lookup:'Account_Owner'=’Martin Dee’

In this instance ‘Account_Owner’ is a custom variable stored in the list and ‘Martin Dee’ would be one of the values used in that varaible. I could not get the system to accept this condition as being valid and I got an error message every time I tried to save it. 

 

In the end I got the template working successfully using the condition structure of:

'Martin' in person|lookup:'Account_Owner'

But, I’d still like to understand what I was doing wrong in the first example. Can anyone explain it to me please?

icon

Best answer by Dov 18 August 2021, 15:22

View original

2 replies

Userlevel 7
Badge +61

Hello @Martin_Dee,

Thank you for sharing this with our Klaviyo Community. I am glad to hear that you were able to get the logic working through some experimentation.

Yes, happy to explain. Since you have multiple values stored for the custom property “Account_Owner”, you are working with a list data type. The former condition structure: (person|lookup:'Account_Owner'=’Martin Dee’) will only work for text (string) or number data types. When working when list data, you need to use the latter condition structure which calls out the value in the custom property at the beginning of the statement ('Martin' in person|lookup:'Account_Owner'). If you look at the conditional structures portion of our documentation, you’ll see some examples with acceptable data types per condition in the chart, including these two scenarios.

I hope that is helpful!

Badge +3

That makes sense and I should have thought of it! Thank you for a clear explanation, I’ll watch out for data types in the future :grin:

Reply