Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum
Suggested answer

Passing current contact to a complex query

Posted on by 3
Hi,
I have a complex query that returns a list of projects that a contact is related to.  To return the list of projects, I have a fairly complex fetchxml query that i want to pass the current contact to as a filter expression, how do I do this?
cheers
Steve.
  • Suggested answer
    SeanRoque Profile Picture
    SeanRoque 4 on at
    Passing current contact to a complex query
    If you're talking about using a QueryExpression in your code and you want to pass your fetch as a filter, you can use the SDK FetchXmlToQueryExpressionResponse to convert your fetchxml string (use string format to include your current contact id) to a QueryExpression and use that. See this post on how you might go about doing that https://community.dynamics.com/blogs/post/?postid=3f01c4e7-2113-4a1b-b728-e7d2d6362c71
     
    If you just want a way to retrieve the list of projects, I recommend the XrmToolBox tool "Export To Excel" https://www.xrmtoolbox.com/plugins/Ryr.XrmToolBox.ExportToExcel/ has a button that utilizes another tool "FetchXML Builder"  https://www.xrmtoolbox.com/plugins/Cinteros.Xrm.FetchXmlBuilder/ to let you edit the fetch, and extract records as a spreadsheet.
  • MH-16081421-0 Profile Picture
    MH-16081421-0 9 on at
    Passing current contact to a complex query
    Hi Steve.
     
    "I want to pass the current contact to as a filter expression" sounds like you are trying to create a generic FetchXML. Is this correct? If so, would you mind posting the FetchXml? At least the relevant parts would help.
     
    Michael
  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 290,263 Super User 2024 Season 2 on at
    Passing current contact to a complex query
    Thanks for your reply. I'm not able to help with this. Let's wait for another volunteer to chime in.
  • wigneys1 Profile Picture
    wigneys1 3 on at
    Passing current contact to a complex query
    It's a model driven app built on Dynamics 365 Sales Enterprise...
  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 290,263 Super User 2024 Season 2 on at
    Passing current contact to a complex query
    Hi wigneys1,
     
    Can you tell us for which exact Dynamics 365 application you are seeking help on this forum?

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 9th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

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

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 228,112 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans