Skip to main content
Question

Use liquid with objects


Hi,

I’ve got some issues using liquid with my objects’ attributes.

I was previously using {{company.owner}} when I was referring to the CRM owner of a company. 

But I recently created new Objects to refer to these companies and can’t figure out how to create liquid for an attribute linked to my objects companies.

 

I’m using {{ objects.companies[0].name }} to refer to the company itself but can’t find out how to refer to the owner as {{ objects.companies[0].owner }} doesn’t work. 

 

I also would like to use this in the following formula : {% if objects.companies | owner == 'Anaïs'  %} …

 

Could you please help me? :) 

2 replies

Penny
  • 133 replies
  • May 27, 2024

Hi @Eva_1604 

 

In this case, would you be able to check if your new object for companies - has the attribute “owner” it sounds like like your object may not have the attribute named “owner”, which is why the Liquid is failing? 

For this Liquid code: {% if objects.companies | owner == 'Anaïs'  %} would you be able to expand on what you’re hoping to achieve here? In this case, I believe the syntax should be along the lines of:

{% if objects.companies[0].owner == 'Anaïs' %} Hi Anaïs! {% ekse %}Hi there! {% endif %}

 

One thing that might be helpful would be to try to generate Liquid with AI and this help documentation would provide more details on this: https://customer.io/docs/journeys/objects-in-liquid/#objects-liquid-ai


Penny
  • 133 replies
  • May 28, 2024

Hi @Eva_1604 ,

Would you be able to check if your object companies has an attribute named “owner”? The syntax of {{ objects.companies[0].owner }} is correct but if it is failing - it is most likely due to a missing attribute - perhaps specific to the company that the profile you’re previewing for is related to. \

With regards to the IF condition, you’d most likely want to use:

{% if objects.companies[0].owner == ‘Anaïs’ %}Hi Anaïs{% else %} Hello there{% endif %}

 

In case it’s helpful, you could also try generating Liquid using AI. More on that here: https://customer.io/docs/journeys/objects-in-liquid/#objects-liquid-ai

Hopefully this helps to move you along in the right direction! 

 

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings