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 :
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

I have the same question (0)
  • Suggested answer
    sdfasdf Profile Picture
    842 on at

    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.

  • Suggested answer
    Bipin D365 Profile Picture
    28,983 Moderator on at

    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

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

#1
Martin Dráb Profile Picture

Martin Dráb 45 Most Valuable Professional

#2
iampranjal Profile Picture

iampranjal 36

#3
Satyam Prakash Profile Picture

Satyam Prakash 31

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans