I'm not able to display user data in email template

I’m trying to display this code in the passwordless email template

 <strong>{{ application.name }}</strong>
              <strong>{{ user.name }}</strong>
              <strong>{{ user.user_metadata.exam_link }}</strong>
              <pre>
              {% for item in user %}
							  {{ item[0] }}: {{ item[1] }}
							{% endfor %}

But for some reason is not displaying all the user fields available (I want user name & metadata), is just displaying this fields: email, source_ip, country, city, application name

I saw in the docs that user object is full available for customized emails

What am I doing wrong??

Hello @sgurillo!

When you’re talking about the passwordless email template, I’m assuming you’re talking about the Verification Code for Email MFA email template. The email templates can be configured with Liquid Syntax which it seems you’re doing in the sample code you posted. I would recommend going over the docs for loops with tags to ensure the syntax is correct. The code you are running is getting all the key value pairs from the user variable which contains all the fields you mentioned. If you would like the metadata instead, then running the code

{% for item in user.user_metadata %}
  {{ item[0] }}: {{ item[1] }}
{% endfor %}

should get all the values kept in the user metadata. If the user.user_metadata.exam_link is not showing up, I would suggest ensuring the field exists for the user you are trying to get it from.

Please let me know if this helps!

Best,
Alex

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.