Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

Liquid Template variable assign issues

$
0
0

Hello Friends,
My basic objective is to set Entity Form on the portal page dynamically based on the users age, If user is above 19 I have to show Entity Form 'A' and if user is under 19 Entity Form 'B' will be showed.

And I'm working on the approach that through web template I will render entity form dynamically and here it is my code on the web template:

{% extends 'Layout 1 Column' %}

{% block main %}

<script> var age = "{{user.birthdate}}";

var condition = '';

var date = age.substring(0,age.indexOf(" "));

var start = new Date(date),

end = new Date(),

diff = new Date(end - start),

days = diff/1000/60/60/24;

var actualdays = parseInt(days,10);

alert(actualdays);

if(actualdays > 6935) { condition='true'; {% assign userage = 'Form A' %}

alert("{{userage}}"); }

else { condition='false'; {% assign userage = 'Form B' %}}

</script>

<div class="container">{% entityform name: userage %}</div>

{% endblock %}

But every time the form 'A' is rendering on the portal even though the userage value showing correctly on alert. Please help on this issue.

Thanks.

Muhammad Ebad


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images