Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum
Suggested answer

Pull query based on two entities

Posted on by 161

I need to pull a query of all contacts with a Parent contact type and a role from the connections table of primary contact. Is there an easy way to pull queries like this in Dynamics? In SQL I could just write a query. Is there something similar in Dynamics?

  • Suggested answer
    Haig Liu Profile Picture
    Haig Liu Microsoft Employee on at
    RE: Pull query based on two entities

    Hi RyeTeacher,

    If you want to query the data using code, you can use the Web API:

    https://learn.microsoft.com/en-us/power-apps/developer/data-platform/webapi/query-data-web-api

    Unlike databases, Web APIs can also be used in conjunction with FetchXML, which is a proprietary query language.

  • Suggested answer
    Charan Raju C R Profile Picture
    Charan Raju C R 3,155 Moderator on at
    RE: Pull query based on two entities

    If I have understood your requirement correctly, you need to retrieve all the contacts where the relationship with other contacts via Connection Role is 'Parent'. If so, you can build a fetch xml query from advanced find as below -

    pastedimage1677949139721v1.png

    This fetch xml query can be downloaded and utilized in plug-in or reports based on your requirement.

  • Martin Dráb Profile Picture
    Martin Dráb 228,647 Most Valuable Professional on at
    RE: Pull query based on two entities

    Which Dynamics product do you mean?

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,558 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,647 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans