Solved

Multiple variables fallback in personalization not working

  • 27 July 2023
  • 2 replies
  • 115 views

Badge

I found this article:

https://help.klaviyo.com/hc/en-us/articles/4408802648731

This syntax is super bizarre, but setting that aside, it which indicates a way to not only use nested variables, but to then have multiple fallbacks it seems.

Assume I have a 2 user profile properties, one is nested and other is not:

"Custom Domains": {
"Enabled": true,
"Url": "foo.com"
},
"Shop Url": "bar.com"

However, i’m having problem with these personalization templating:

{{ person|lookup:"Custom Domain"|lookup:"Enabled"|default:"not found"}}

{{ person|lookup:"Custom Domain"|lookup:"Url"|default:"not found" }}

{{ person|lookup:"Custom Domain"|lookup:"Url"|person|lookup:"Shop Url"|default:"not found" }}

Am I interpreting the docs wrong and we cannot use nested properties?  It’s a total pain to not have the UI expose nested props correctly.

icon

Best answer by Taylor Tarpley 27 July 2023, 23:11

View original

2 replies

Userlevel 7
Badge +60

Hi @tmchow-bc

 

Welcome to the Community! Glad to see you already using our Help Center resources, happy to help! 

 

I think there might be a few reasons why you weren’t having success calling your profile property previously. First, variables can only be nested if its an event variable, profile properties can’t be nested. With that in mind, the syntax you’d be looking to use to call your profile property should follow the profile variable formula, not event variable formula which you link above. An example of what you should use is linked below!

person|lookup:'Custom Domains'

 

Additionally, you won’t need to set up multiple backups to ensure it shows. I think your previous syntaxes you link are also missing the ‘s’ on Domains.

 

Finally, our default filter will show what you put in quotations if the profile property you’re calling doesn’t exist. I wanted to call that out as I wasn’t sure you wanted to show ‘not found’ in your email to users who don’t have a custom domain profile property. 

 

Thanks for participating in the Community!

-Taylor 

 

Badge

Hi @tmchow-bc

 

Welcome to the Community! Glad to see you already using our Help Center resources, happy to help! 

 

I think there might be a few reasons why you weren’t having success calling your profile property previously. First, variables can only be nested if its an event variable, profile properties can’t be nested. With that in mind, the syntax you’d be looking to use to call your profile property should follow the profile variable formula, not event variable formula which you link above. An example of what you should use is linked below!

person|lookup:'Custom Domains'

 

Additionally, you won’t need to set up multiple backups to ensure it shows. I think your previous syntaxes you link are also missing the ‘s’ on Domains.

 

Finally, our default filter will show what you put in quotations if the profile property you’re calling doesn’t exist. I wanted to call that out as I wasn’t sure you wanted to show ‘not found’ in your email to users who don’t have a custom domain profile property. 

 

Thanks for participating in the Community!

-Taylor 

 

Thanks. The example I gave was retyped so my issue isn’t the pluralization. The issue is what you pointed out which is:

 

”…variables can only be nested if its an event variable, profile properties can’t be nested. ”

This is hugely disappointing as I swear during the sales process we were told nested properties were supported for both events and people.  
 

this means we have to flatten the properties when calling the Klaviyo APIs. Yuck. 
 

Regarding this comment:

Additionally, you won’t need to set up multiple backups to ensure it shows.”

 

My concern is I cannot guarantee that a prop will be set so I want to fallback to use a different property if that’s the case. The last fallback is the default case in case for some reason none of the props were set. 
 

the “not found” string was just me doing that for our testing so it was clear it wasn’t found. 

Reply