Showing posts with label FetchXML. Show all posts
Showing posts with label FetchXML. Show all posts

How to Dynamically Insert GUIDs into FetchXML Queries in C# and JavaScript

 When working with Microsoft Dynamics 365 CRM, FetchXML provides a robust mechanism for querying and retrieving data. A common requirement is to filter records based on specific GUIDs, which represent unique identifiers for records. In this article, we explore how to dynamically insert GUIDs into FetchXML queries using C# and JavaScript, ensuring that your queries can be adapted to various data retrieval scenarios efficiently.

FetchXML: Aggregating and Counting Data in Dynamics 365

FetchXML is an XML-based query language that enables data retrieval from Microsoft Dynamics 365's underlying database. It is used in scenarios where you need to read data directly from the server without using SQL queries. FetchXML is especially useful in online environments where direct database access is restricted. 

Understanding Distinct FetchXML Queries in Dynamics 365

 

Understanding Distinct FetchXML Queries in Dynamics 365

In Dynamics 365, FetchXML plays a crucial role in querying data for various applications, including reports, custom web resources, and integrations. One of the powerful features of FetchXML is the ability to use the distinct attribute to ensure that the query results contain unique records. However, understanding the scope and limitations of the distinct attribute is key to constructing effective queries. This article delves into some important considerations when working with distinct in FetchXML queries.

[TIP] Conditionally Displaying Actions in Power Apps Portal Lists

 

Conditionally Displaying Actions in Power Apps Portal Lists

Introduction

In Power Apps Portals, displaying list actions like "Edit," "Delete," or custom actions conditionally can be a crucial requirement. The need for conditional display often arises based on specific attributes or states of the data being displayed. In this article, we will explore how you can conditionally show or hide actions on lists in Power Apps Portals.

Dynamics 365 CRM Show/Retrieve Data of Grandparent Record

Requirement:

    We have a construct like entity1 - 1:n - entity2 - 1:n - entity3, and want to display data from entity1 in entity3 (form or list). 

Example:

     Opportunity 1:n Account

     Account 1:n Contact (Primarry Contact)

     Opportunity  no relationship with Contact (Primary Contact)

     So using Dynamics 365 CRM Advanced Find cannot retrieve fields of Contact to Opportunity list.

Solution:

      XrmtoolBox + FetchXML

  1. XML:     Download

      <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">

  <entity name="opportunity">

    <attribute name="name" />

    <attribute name="parentaccountid" />

    <filter type="or">

      <condition attribute="statecode" operator="eq" value="1" />

      <condition attribute="statecode" operator="eq" value="2" />

    </filter>

    <filter type="and">

      <filter>

        <condition attribute="actualclosedate" operator="last-x-months" value="8" />

      </filter>

    </filter>

    <order attribute="name" descending="false" />

    <link-entity name="account" from="accountid" to="customerid">

      <attribute name="primarycontactid" />

      <link-entity name="contact" from="contactid" to="primarycontactid">

        <attribute name="emailaddress1" />

      </link-entity>

    </link-entity>

  </entity>

</fetch>



     Result:



2. XrmToolBox:

  • FetchXML Builder:   Create XML

   

  • Export To Excel:   Export retrieve report to excel spreadsheet, work with FetchXML Builder