GOGETMUSCLE Community Querying Company File-type field in email template

Querying Company File-type field in email template

Hi,

I want to send an email to contacts. That email must contain an image which is stored in a custom field in the contact’s Company object.

I tried accessing the property directly :

Test : {{ company.pie_chart }}
Test : {{ contact.company.pie_chart }}

It returns nothing. I tried using the personalization tokens :

{% set pie_chart = personalization_token(“company.pie_chart”) %}

That one works ! BUT, it doesn’t return an image or a URL, only a file ID. I tried using that ID to get the file itself :

{% if pie_chart %}
{% set pie_chart_file = file_by_id(pie_chart) %}
{% set pie_chart_url = pie_chart_file.friendlyUrl %}

{% endif %}

But this doesn’t work. I think the personalization token gets processed after the file_by_id() function, so the result of personalization_token cannot be passed as an argument to file_by_id().

Is there another way to get the image stored in the file field to be embedded in the email as a normal image ?

Thank you for your help.

Leave a Reply

Your email address will not be published.

Related Post