E-mail adres of current user

When I assign a ToDo to an external user I would like to hide parts of the template that are for intrenal use only. Can I get the user information of the current user in a drop somehow so I can make an if statement like:

{% if user.email contains "@mycompany.com" %}
Show content
{% endif %}

Is there any way to do this?

Hi @ronald_groot_RSF,

This is exactly the way to do it. Is this code not working for you?

Regards,
Kimberly

Okay, silly me… I couldn’t get it working and did not find any documentation, so I created the topic.

It works perfectly if I do not use the ‘@’ symbol. Using the ‘@’ somehow prevents me from getting the result I want. So this works:

{% if user.email contains "mycompany.com" %}
Show content
{% endif %}

Thanks @Kimberly_Vlietinck

Has there been a change that causes the user.email drop to stop working? All checks on this check have stopped working all of a sudden and fetching the field provides me with no data. Please help?!

Hi @ronald_groot_RSF,

The user.email drop still works, you can easily check this by printing {{ user.email }} in a document. Can you be more specific what check is not working, what did you expect to happen and what SF is showing instead?

Best regards,

Michiel

Hi @Michiel,

That’s what I checked. I’ve added this to my template:

Test is data is shown
{{ user.email }}
Test if data is shown

And this is what I see:

Test is data is shown

Test if data is shown

Hi @ronald_groot_RSF,

This was a small bug in our code, which has been solved in the meantime.

Best regards,

Michiel

1 Like