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

Notifications

Announcements

No record found.

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

I have the same question (0)
  • 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans