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 :
Customer experience | Sales, Customer Insights,...
Answered

{Portal} Liquid Error retrieving optionset value

(0) ShareShare
ReportReport
Posted on by

I have a content snippet accessing the contact record via the user variable.

let currentMembershipLabel = '{{ user.abc_membershiptype.label}}';

let currentMembership = '{{ user.abc_membershiptype.value}}';

The currentMembershipLabel has the correct text for the option set value selected, however the .value gets a type conversion error:

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

I have tried:

  • let currentMembership = '{{ user.abc_membershiptype.value | string }}';
  • let currentMembership = {{ user.abc_membershiptype.value}};

however i get the same error.

Thanks in advance for your assistance.

I have the same question (0)
  • Esteban Coto Alfaro Profile Picture
    on at

    Hello, check this documentation of Liquid filters: docs.microsoft.com/.../liquid-filters

    I hope it helps!

    Thanks!

    Community Support Team - Esteban

    If this Post helps, then please consider Accept as solution to help the other members find it more quickly.

  • Glenn.J Profile Picture
    on at

    Thanks Esteban.  

    I had looked through that page and nothing there gave any indication on why the problem is occurring or how to resolve.

    I've tried both as string and int with no success.  Strangely even when I'm not referencing the value as a string the backend is trying to convert it to a string (i.e. I get the same error).

  • Verified answer
    ArunLalPrasanth Profile Picture
    25 on at

    Hi Glenn,

    I was facing the same issue. Try the below code. I used the same way in liquid tags under web templates.

    let currentMembership = '{{ user["abc_membershiptype"].value}}';

    Thanks

    Arun

  • Glenn.J Profile Picture
    on at

    Thanks Arun.  Worked perfectly.  

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 70 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 43 Most Valuable Professional

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans