Skip to main content
Solved

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

  • August 17, 2021
  • 2 replies
  • 1046 views

Forum|alt.badge.img+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?

Best answer by Dov

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!

View original
Did this topic or the replies in the thread help you find an answer to your question?

2 replies

Dov
Forum|alt.badge.img+61
  • Klaviyo Alum
  • 1493 replies
  • Answer
  • August 18, 2021

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!


Forum|alt.badge.img+3
  • Author
  • Contributor I
  • 1 reply
  • August 18, 2021

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: