web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

{Portal} Error while accessing fields using liquid

(0) ShareShare
ReportReport
Posted on by 55,410 Moderator

I am trying to retrieve the entity records using fetch xml/ liquid within a web template. This works fine accept that for one decimal field, I am getting the below error.

Liquid error: Object of type 'System.Decimal' cannot be converted to type 'System.String'.

How do we convert decimal objects to string in liquid?

I am referring this blog post: dyn365apps.com/.../dynamics-365-portals-liquid-templates-part-3-retrieve-data-using-fetchxml

Here is my current liquid code. new_amount is the decimal field

===

{% for result in my_query.results.entities %}
<div name="main-content" style="margin-left: 300px; max-width: 800px;">
<h1> {{ result.new_name | escape }} </h1>
<h2> {{ result.new_amount | escape }} </h2>              
</div>
{% endfor %}
=========

*This post is locked for comments

  • Verified answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    It turns out that we can simply convert it decimal to string as follows-

    {{ result.new_amount | string }}

  • RaviKashyap Profile Picture
    55,410 Moderator on at

    {bump}

  • Milansinh Raj Profile Picture
    230 on at

    Hey Ravi Kashyap,

    I am facing same issue for entity reference type value.

    I want to get that record id of entity reference field.

    What should i do ?

    result.questionid

    Thank you,

    Milansinh Raj

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
ScottDurow Profile Picture

ScottDurow 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans