Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Using 'Under' query relation against multiple fields

(0) ShareShare
ReportReport
Posted on by 5

Hi,

I'm just getting to grips with Dynamics CRM and I am having difficulty with this Advanced Find query.

We have a table of Contacts, and a table of Accounts. Each Contact has three fields, Organisation 1, Organisation 2 and Organisation 3. The university I work for has its own account University of X and each department has its own account, which is hierarchically linked to the University of X account by the Parent Account field. The departmental Accounts may link to a Contact under any of the three Organisation fields.

I need to set up query that finds all contacts for whom one or more of the Accounts linked under the Organisation fields has University of X as Parent Account or for whom any of the Organisation fields links directly to University of X. My proposed structure is:

OR

-- "Organisation 1" Equals "University of X"

-- "Organisation 2" Equals "University of X"

-- "Organisation 3" Equals "University of X"

-- "Organisation 1" Under "University of X"

-- "Organisation 2" Under "University of X"

-- "Organisation 3" Under "University of X"

... but this query won't work, because you cannot group the Under clauses with the OR grouping. Surely there is a way to do this? Please can you offer any help?

Thanks!

*This post is locked for comments

  • Suggested answer
    Dynamics365 Rocker Profile Picture
    Dynamics365 Rocker 7,755 on at
    RE: Using 'Under' query relation against multiple fields

    Try XRM toolbox.

    There you can create your own fetch xml and test it.

  • Walkingbeard Profile Picture
    Walkingbeard 5 on at
    RE: Using 'Under' query relation against multiple fields

    Thank you, I'll take a look!

  • Suggested answer
    StefanS365 Profile Picture
    StefanS365 3,573 Most Valuable Professional on at
    RE: Using 'Under' query relation against multiple fields

    Hi there,

    You could use the XrmToolBox plugins to create these more advanced Fetch XML queries:

    - FetchXML Builder (https://fxb.xrmtoolbox.com/)

    - View Designer (www.xrmtoolbox.com/.../)

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans