如果声明问题,液体模板

问题描述 投票:2回答:2

目前我在Dynamics 365门户网站工作,我的目标是在某些条件下动态设置实体表单名称。但问题是,即使条件验证,它总是呈现表格A.这是代码:

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

请指教。

dynamics-crm crm liquid microsoft-dynamics adxstudio-portals
2个回答
0
投票

几点建议:

user.age字段是自定义字段吗?在这种情况下,它可能会有一个前缀,例如user.xyz_age

这可能实际上不是一个有效的语法{%if user.age > 18%},那里不应该有几个空格?例如。 {% if user.age > 18 %}

尝试打印{{ user.age }}以确认该值是您实际认为的值。


0
投票

我想,age属性来自于您在此模板上使用Fetchxml而创建的对象。

我的建议是沿着值samwhere打印,使用{{ user.age }}并查看它是否总是大于18

© www.soinside.com 2019 - 2024. All rights reserved.