SBX - Search With Button

SBX - Forum Post Title

How to Debug Liquid Template code

Microsoft Dynamics CRM Forum

Lester DSouza asked a question on 27 Mar 2017 4:04 AM
My Badges

Question Status

Suggested Answer

Hi All, I wanted to know if there is way to debug the liquid template code that i have used in creating a web template?

Thanks in advance.

Reply
Moin Khan responded on 23 May 2017 2:26 AM
My Badges

Hi DSouza,

I am also having the same query did got your answer ?

Reply
Andreas Cieslik responded on 23 May 2017 4:46 AM
My Badges
Suggested Answer

There is not a lot that you can do, but to use console.log statements.

Maybe this page provides you a helpful snippet to log variables for debugging purposes more easily:

github.com/.../121

Reply
Lakshmisha Shetty responded on 23 May 2017 4:58 AM
My Badges
Suggested Answer

Hi Lester,

You can not debug the Liquid templet. However you can use browser devloper console to check the values and your conditions.

Reply
Vivek Shah responded on 30 May 2017 12:15 AM
My Badges
Suggested Answer

There is no known way to debug a liquid template, since it is client side scripting.

Although you can use browser developer tool as suggested.

Reply
Dylan responded on 7 Feb 2018 4:30 PM
Suggested Answer

I've found the easiest ways are:

For an attribute/property - to insert the values into the DOM:

<p>{{object.attribute}}</p>

or if you'd rather nobody saw your testing:

<p style="display: none;">{{object.attribute}}</p>


For a condition, alert or log something

{% if youLikeBananas == true %}
  alert("They're good and good for you.")
{% endif %}

again, if you'd rather nobody saw it

{% if youLikeBananasAndDontWantAnybodyToKnow == true %}
  console.log("You're no fun :( ")
{% endif %}


What I'd really like is to know how to inspect an entire object when you're not certain of its available attributes; for example...

{{entity['fruit basket']}} {$ comment %} show me all of it's goodness {$ endcomment $}


Reply
SD_Dev responded on 12 Jun 2019 9:39 PM
My Badges

Thanks.

But how do I check it from the browser? console.log() doesn't really help.

Reply
Andreas Cieslik responded on 23 May 2017 4:46 AM
My Badges
Suggested Answer

There is not a lot that you can do, but to use console.log statements.

Maybe this page provides you a helpful snippet to log variables for debugging purposes more easily:

github.com/.../121

Reply
Lakshmisha Shetty responded on 23 May 2017 4:58 AM
My Badges
Suggested Answer

Hi Lester,

You can not debug the Liquid templet. However you can use browser devloper console to check the values and your conditions.

Reply
Vivek Shah responded on 30 May 2017 12:15 AM
My Badges
Suggested Answer

There is no known way to debug a liquid template, since it is client side scripting.

Although you can use browser developer tool as suggested.

Reply
Dylan responded on 7 Feb 2018 4:30 PM
Suggested Answer

I've found the easiest ways are:

For an attribute/property - to insert the values into the DOM:

<p>{{object.attribute}}</p>

or if you'd rather nobody saw your testing:

<p style="display: none;">{{object.attribute}}</p>


For a condition, alert or log something

{% if youLikeBananas == true %}
  alert("They're good and good for you.")
{% endif %}

again, if you'd rather nobody saw it

{% if youLikeBananasAndDontWantAnybodyToKnow == true %}
  console.log("You're no fun :( ")
{% endif %}


What I'd really like is to know how to inspect an entire object when you're not certain of its available attributes; for example...

{{entity['fruit basket']}} {$ comment %} show me all of it's goodness {$ endcomment $}


Reply

SBX - Two Col Forum

SBX - Migrated JS