Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Pages - General Discussions
Answered

Pages - fetchxml to query yes no field?

(0) ShareShare
ReportReport
Posted on by 116

I need to get the value of a yes/no field with fetch xml on a service page, in javascript i would do something like this

 

 

var varQ5 = $('#lc_yesnofield_0')[0].checked;

 

 

in fetch xml i have tried many variations of this

 

 

{%- assign ownerid = request.params["id"] -%}
{%- if ownerid -%}
{%- fetchxml lookupfacility -%}
<fetch no-lock="true" distinct="true">
 <entity name="lc_owner">
 <attribute name="lc_ownerid" />
 <attribute name="lc_yesnofield" />
 <filter>
 <condition attribute="lc_ownerid" operator="eq" value="{{ ownerid }}" />
 </filter>
 </entity>
</fetch>
{%- endfetchxml -%}
{%- assign results = lookupfacility.results.entities -%}
[
{%- for facility in results -%}
{ "ownerid" : "{{facility.lc_ownerid}}", "yesnofield" : "{{facility.lc_yesnofield.Value}}" } {%- unless forloop.last -%},{%- endunless -%}
{%- endfor -%}
]
{% else %}
[]
{% endif %}

 

 

anyone able to point me in the right direction?

Categories:
  • Verified answer
    Jeff_ccs Profile Picture
    116 on at
    Re: Pages - fetchxml to query yes no field?

    I'm may have over thought it. without .checked at all it returns true/false

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Pages

#1
Fubar Profile Picture

Fubar 69 Super User 2025 Season 1

#2
oliver.rodrigues Profile Picture

oliver.rodrigues 49 Most Valuable Professional

#3
Jon Unzueta Profile Picture

Jon Unzueta 43