Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

Check if there are records created by certain user

(0) ShareShare
ReportReport
Posted on by 5

Hi all

I need to check if there records of entity created by certain user (createdby equals userId). I suppose query with aggregate count (webapi or fetchXML, doesn't matter) is OK. If count > 0 then there are records, pretty obvious.

I wonder if there is some more efficient way to do this. Like Any in LINQ, so that it doesn't go through all collection after finds first element which satisfies the condition.

I found Any function in WebAPI. But as I understand it is only applicable for collection-valued properties of entity

  • Suggested answer
    Bipin D365 Profile Picture
    28,981 Moderator on at
    RE: Check if there are records created by certain user

    Hi,

    Use Count aggregate option in fetchxml to retrieve record count based your filter criteria. Then check if count>0.

    docs.microsoft.com/.../use-fetchxml-aggregation

    Please mark my answer verified if i were helpful

  • Suggested answer
    sdfasdf Profile Picture
    840 on at
    RE: Check if there are records created by certain user

    If you just need to determine whether a particular user created records or not, you may want to limit this query to retrieve the top 1 result. If any results are retrieved, then you can be certain that the user created at least one record. With FetchXML, you can you the top="1" attribute.

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

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June 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 > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Adis Profile Picture

Adis 136 Super User 2025 Season 1

#2
Sohail Ahmed Profile Picture

Sohail Ahmed 81

#3
Jonas "Jones" Melgaard Profile Picture

Jonas "Jones" Melgaard 77 Super User 2025 Season 1

Product updates

Dynamics 365 release plans