Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Answered

{Portal} Liquid Error retrieving optionset value

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.

  • Glenn.J Profile Picture
    Glenn.J on at
    RE: {Portal} Liquid Error retrieving optionset value

    Thanks Arun.  Worked perfectly.  

  • Verified answer
    ArunLalPrasanth Profile Picture
    ArunLalPrasanth 25 on at
    RE: {Portal} Liquid Error retrieving optionset value

    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
    Glenn.J on at
    RE: {Portal} Liquid Error retrieving optionset value

    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).

  • RE: {Portal} Liquid Error retrieving optionset value

    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.

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,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans