2

Currently Im working in Dynamics 365 portals, And my objective is to set entity form name dynamically on some condition. but the problem is it always renders Form A even though the condition verifies. Here is the code:

{%if user.age > 18%}
<div class="container">{% entityform name:'Form A' %}</div>
{%else%}
<div class="container">{% entityform name:'Form B' %}</div>
{%endif%}

Please advice.

ebad
  • 31
  • 3

2 Answers2

0

Couple of suggestions:

Is the user.age field a custom field? In which case it will probably have a prefix, e.g. user.xyz_age.

This might not actually be a valid syntax {%if user.age > 18%}, shouldn't there be a few spaces in there? E.g. {% if user.age > 18 %}

Try printing {{ user.age }} to confirm the value is what you actually think it is.

James Wood
  • 17,286
  • 4
  • 46
  • 89
0

I imagine that the attribute age is coming from an object created as a result of Fetchxml you have on this template.

My suggestion is to print along the the value samwhere, use {{ user.age }} and see if it is always grater than 18

B. Irena
  • 169
  • 7