Announcements
No record found.
Dear Friends
Please guide me how I will fetch the DISTINCT records from Entity using WEB API
Kind Regards
Anil
*This post is locked for comments
As far as I know, you can only do this by submitting the query as a Fetch and specifying distinct="true" in the FetchXML
Hi Anil,
Try this syntax
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
<entity name="incident">
<attribute name="incidentid" />
<attribute name="title" />
<attribute name="customerid" />
<attribute name="statuscode" />
<attribute name="caseorigincode" />
<order attribute="title" descending="false" />
<filter type="and">
<condition attribute="ownerid" operator="eq-userid" />
<condition attribute="statecode" operator="eq" value="0" />
</filter>
</entity>
</fetch>
are you using within the Portals through oData? is this Portals or CRM? did you tag "Portals" by mistake maybe? can you please untag?
It really needs to be possible to do this without XML. XML parsing is very slow. Does anyone know if a JSON is possible or a direct query instead? Not really understanding why a simple $distinct='true' isn't possible or something like that in a regular query.
Hello,
Would a group by be suitable for you?
Group by with $apply: /api/data/v9.2/accounts?$apply=groupby((name,accountnumber))
Source : docs.oasis-open.org/.../odata-data-aggregation-ext-v4.0-cs01.html
Hello Anil,
- Yes you can use group by attribute to get distinct records.- Here we fetch contact with distinct lastname. => /api/data/v9.0/contacts?$apply=groupby((lastname,firstname))- Also you can use fetchXml to get distinct record by using distinct='true'.
since XML is slow, it is hard to say where the breaking point is on just getting everything and creating a distinct list yourself. It would be much better to just have a $&Distinct='true' in the URL.
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.
Congratulations to our 2026 Super Stars!
We are thrilled to have these Champions in our Community!
These are the community rock stars!
Stay up to date on forum activity by subscribing.