Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Portal liquid template

Posted on by 2

Hi,

In the portal I get some data in liquid with fetchxml.

Depending on the state of the record (active/inactive), I need to display different information.

I'm bale to get the state information by using {{item.statecode.value }} which returns 0 for an active record.

However I'm not able to use it in a condition: {% if item.statecode.value==0 %}code{% endif %}.

The code does not get executed.

What would be the right syntax to be able to differntiate between active and inactive records?

*This post is locked for comments

  • Suggested answer
    Birgit RD Profile Picture
    Birgit RD 2 on at
    RE: Portal liquid template

    I check it as a string value, and it does indeed work.

    Thanks

  • Suggested answer
    Jharana Baliyar Singh Profile Picture
    Jharana Baliyar Singh 2,665 on at
    RE: Portal liquid template

    Hi Birgit,

    I think it should be

    {% if item.statecode.value :0 %}code{% endif %}.Try with this.

  • Verified answer
    RE: Portal liquid template

    Hi Birgit,

    Try below code,

    {% if item.statecode.value=="0" %}code{% endif %}

    Some time in java script it treat numaric value as String.

    Mark as Answer if it helps you.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans