<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SSIS Dynamics CRM Source Archives | ZappySys Blog</title>
	<atom:link href="https://zappysys.com/blog/category/ssis/components/ssis-dynamics-crm-source/feed/" rel="self" type="application/rss+xml" />
	<link>https://zappysys.com/blog/category/ssis/components/ssis-dynamics-crm-source/</link>
	<description>SSIS / ODBC Drivers / API Connectors for JSON, XML, Azure, Amazon AWS, Salesforce, MongoDB and more</description>
	<lastBuildDate>Thu, 11 Dec 2025 13:00:52 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.4.4</generator>

<image>
	<url>https://zappysys.com/blog/wp-content/uploads/2023/01/cropped-zappysys-symbol-large-32x32.png</url>
	<title>SSIS Dynamics CRM Source Archives | ZappySys Blog</title>
	<link>https://zappysys.com/blog/category/ssis/components/ssis-dynamics-crm-source/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to register App for Dynamics CRM 365 / CDS / Dataverse API (Azure AD / OAuth)</title>
		<link>https://zappysys.com/blog/register-app-dynamics-crm-365-cds-dataverse-api-azure-ad-oauth/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Mon, 29 Nov 2021 21:20:53 +0000</pubDate>
				<category><![CDATA[SSIS Dynamics CRM Connection]]></category>
		<category><![CDATA[SSIS Dynamics CRM Destination]]></category>
		<category><![CDATA[SSIS Dynamics CRM Source]]></category>
		<category><![CDATA[d365]]></category>
		<category><![CDATA[dynamics crm]]></category>
		<category><![CDATA[Microsoft Dynamics 365]]></category>
		<category><![CDATA[oauth]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=9444</guid>

					<description><![CDATA[<p>Introduction In this article, we will show you step by step approach on how to register an Azure AD (Active Directory) app to access Dynamics CRM 365 API (also same for CDS / Dataverse API). You might have heard that Microsoft is deprecating an older way of authenticating (i.e. User ID / Password-based WS-Trust Authentication) [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/register-app-dynamics-crm-365-cds-dataverse-api-azure-ad-oauth/">How to register App for Dynamics CRM 365 / CDS / Dataverse API (Azure AD / OAuth)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p>In this article, we will show you step by step approach on how to register an Azure AD (Active Directory) app to access Dynamics CRM 365 API (also same for CDS / Dataverse API). You might have heard that <a href="https://zappysys.zendesk.com/hc/en-us/articles/5258505448347">Microsoft is deprecating</a> an older way of authenticating (i.e. User ID / Password-based <strong>WS-Trust</strong> Authentication) on <strong>April 2022</strong>. You must update your jobs / code to use OAuth 2.0 by April 2022 for any CRM related API calls.</p>
<p>In other words rather than User Id / password now you can use more secure way by using <strong>OAuth</strong> rather than WS-Trust.</p>
<p>Going forward Microsoft wants you to use OAuth Token rather than user name/password to call Dynamics CRM 365 API programmatically.</p>
<p><a href="https://docs.microsoft.com/en-us/power-platform/important-changes-coming#deprecation-of-office365-authentication-type-and-organizationserviceproxy-class-for-connecting-to-dataverse" target="_blank" rel="noopener">Here is the official link which describes the dates for WS-Trust sunset</a></p>
<h2>Register App for CRM / CDS / Dataverse in Azure / Active Directory</h2>
<p>The first step is to register your app in Azure Portal under Active Directory using the below steps.</p>
<ol>
<li>Ask your Active Directory Admin to login to Azure Portal and navigate to &gt; <a href="https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/Overview" target="_blank" rel="noopener"><strong>Active Directory</strong></a> Blade.<br />
OR<br />
You can access it by searching &#8220;<strong>Azure Active directory</strong>&#8221; like below.</p>
<div id="attachment_9445" style="width: 403px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2021/11/open-azure-active-directory.png"><img fetchpriority="high" decoding="async" aria-describedby="caption-attachment-9445" class="size-full wp-image-9445" src="https://zappysys.com/blog/wp-content/uploads/2021/11/open-azure-active-directory.png" alt="Open Azure Active Directory" width="393" height="224" srcset="https://zappysys.com/blog/wp-content/uploads/2021/11/open-azure-active-directory.png 393w, https://zappysys.com/blog/wp-content/uploads/2021/11/open-azure-active-directory-300x171.png 300w" sizes="(max-width: 393px) 100vw, 393px" /></a><p id="caption-attachment-9445" class="wp-caption-text">Open Azure Active Directory</p></div></li>
<li>Now click on the <a href="https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredApps" target="_blank" rel="noopener"><strong>App Registrations</strong></a> icon and click <strong><strong>New App Registration<br />
</strong></strong></p>
<div id="attachment_9446" style="width: 535px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2021/11/open-azure-active-directory-new-app-registration.png"><img decoding="async" aria-describedby="caption-attachment-9446" class="size-full wp-image-9446" src="https://zappysys.com/blog/wp-content/uploads/2021/11/open-azure-active-directory-new-app-registration.png" alt="New App Registrations under Azure Active Directory" width="525" height="275" srcset="https://zappysys.com/blog/wp-content/uploads/2021/11/open-azure-active-directory-new-app-registration.png 525w, https://zappysys.com/blog/wp-content/uploads/2021/11/open-azure-active-directory-new-app-registration-300x157.png 300w" sizes="(max-width: 525px) 100vw, 525px" /></a><p id="caption-attachment-9446" class="wp-caption-text">New App Registrations under Azure Active Directory</p></div></li>
<li>Now next step is to give your <strong>App name</strong> to identify easily. Select App is used for your Org only option (Default) and last enter <strong>Redirect URL</strong> as below (This URL is used for 3-legged Authorization Code Grant only). We prefer you enter a URL which is OAuth friendly (If you don&#8217;t know one Use <pre class="crayon-plain-tag">https://zappysys.com/oauth</pre>  this is <strong>recommended</strong> URL if you working with ZappySys Products)
<div id="attachment_9447" style="width: 563px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2021/11/register-azure-active-directory-app-with-redirect-url.png"><img decoding="async" aria-describedby="caption-attachment-9447" class="size-full wp-image-9447" src="https://zappysys.com/blog/wp-content/uploads/2021/11/register-azure-active-directory-app-with-redirect-url.png" alt="Azure AD App Registration - Single / Multi Tenant with Redirect URl (i.e. Call back)" width="553" height="708" srcset="https://zappysys.com/blog/wp-content/uploads/2021/11/register-azure-active-directory-app-with-redirect-url.png 553w, https://zappysys.com/blog/wp-content/uploads/2021/11/register-azure-active-directory-app-with-redirect-url-234x300.png 234w" sizes="(max-width: 553px) 100vw, 553px" /></a><p id="caption-attachment-9447" class="wp-caption-text">Azure AD App Registration &#8211; Single / Multi-Tenant with Redirect URL (i.e. Call back)</p></div>
<p>&nbsp;</li>
<li>Now once App is created you can find the Application (Client) Id from overview page
<div id="attachment_10130" style="width: 633px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2021/11/azure-ad-app-find-application-client-id-1.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10130" class="wp-image-10130 size-full" src="https://zappysys.com/blog/wp-content/uploads/2021/11/azure-ad-app-find-application-client-id-1.png" alt="azure-ad-app-find-application-client-id" width="623" height="360" srcset="https://zappysys.com/blog/wp-content/uploads/2021/11/azure-ad-app-find-application-client-id-1.png 623w, https://zappysys.com/blog/wp-content/uploads/2021/11/azure-ad-app-find-application-client-id-1-300x173.png 300w" sizes="(max-width: 623px) 100vw, 623px" /></a><p id="caption-attachment-10130" class="wp-caption-text">Azure AD App &#8211; Find Application / Client Id on overview page</p></div></li>
</ol>
<h2>Add API Permissions for the App</h2>
<p>Once App is created we need to Add Permission. Basically, we will set which style of APIs can be called by this App and what Actions can be performed.<br />
<div class="su-note"  style="border-color:#e5de9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#FFF8B7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;">For Apps specific to CRM / CDS / Dataverse API, actual app permissions are controlled by User Roles. Check later in this article how to associate one or more Roles to this AD App so it can perform certation actions via API call</div></div>
<ol>
<li>To add API Permissions for this AD App click on <strong>API Permissions</strong> and then click on <strong>Add Permission</strong>
<div id="attachment_9449" style="width: 439px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2021/11/azure-ad-app-add-api-permission.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9449" class="size-full wp-image-9449" src="https://zappysys.com/blog/wp-content/uploads/2021/11/azure-ad-app-add-api-permission.png" alt="Add API Permissions for Azure AD App" width="429" height="517" srcset="https://zappysys.com/blog/wp-content/uploads/2021/11/azure-ad-app-add-api-permission.png 429w, https://zappysys.com/blog/wp-content/uploads/2021/11/azure-ad-app-add-api-permission-249x300.png 249w" sizes="(max-width: 429px) 100vw, 429px" /></a><p id="caption-attachment-9449" class="wp-caption-text">Add API Permissions for Azure AD App</p></div></li>
<li>Find the Dynamics CRM icon and click on it
<div id="attachment_9450" style="width: 669px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2021/11/add-azure-ad-app-api-permission-dynamics-crm.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9450" class="size-full wp-image-9450" src="https://zappysys.com/blog/wp-content/uploads/2021/11/add-azure-ad-app-api-permission-dynamics-crm.png" alt="Add API Permission for Dynamics CRM API access (Azure AD App)" width="659" height="709" srcset="https://zappysys.com/blog/wp-content/uploads/2021/11/add-azure-ad-app-api-permission-dynamics-crm.png 659w, https://zappysys.com/blog/wp-content/uploads/2021/11/add-azure-ad-app-api-permission-dynamics-crm-279x300.png 279w" sizes="(max-width: 659px) 100vw, 659px" /></a><p id="caption-attachment-9450" class="wp-caption-text">Add API Permission for Dynamics CRM API access (Azure AD App)</p></div></li>
<li>Now you will see just one permission for Dynamics CRM (user_impersonation). As we said earlier for Dynamics CRM API security is controlled by User Roles in CRM Portal itself which will see in the next section. For now, just choose <strong>Delegated Permissions</strong>,  check <strong>user_impersonation</strong> and click <strong>Add Permissions</strong>
<div id="attachment_9451" style="width: 661px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2021/11/add-azure-ad-app-api-permission-dynamics-crm-step2.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9451" class="size-full wp-image-9451" src="https://zappysys.com/blog/wp-content/uploads/2021/11/add-azure-ad-app-api-permission-dynamics-crm-step2.png" alt="Select API Permissions for Dynamics CRM App (Azure AD App)" width="651" height="608" srcset="https://zappysys.com/blog/wp-content/uploads/2021/11/add-azure-ad-app-api-permission-dynamics-crm-step2.png 651w, https://zappysys.com/blog/wp-content/uploads/2021/11/add-azure-ad-app-api-permission-dynamics-crm-step2-300x280.png 300w" sizes="(max-width: 651px) 100vw, 651px" /></a><p id="caption-attachment-9451" class="wp-caption-text">Select API Permissions for Dynamics CRM App (Azure AD App)</p></div></li>
<li>Now the last step in Adding API permissions is Grant Admin Consent. If you are logged in as an Azure AD User with the correct admin role then no worries else you have to ask your Azure AD admin to consent for you so this App can be used to read/write data from CRM.</li>
</ol>
<h2>Create Client Secret</h2>
<p>Once App is created next step is to generate a Client Secret. Perform the following steps to create a secret that you can use when you call API</p>
<ol>
<li>Click on Certificates and Secrets and then New Secret
<div id="attachment_9453" style="width: 1008px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2021/11/azure-ad-app-create-client-secret.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9453" class="size-full wp-image-9453" src="https://zappysys.com/blog/wp-content/uploads/2021/11/azure-ad-app-create-client-secret.png" alt="Azure AD App Create Client Secret / Set Name, Expiration Date" width="998" height="540" srcset="https://zappysys.com/blog/wp-content/uploads/2021/11/azure-ad-app-create-client-secret.png 998w, https://zappysys.com/blog/wp-content/uploads/2021/11/azure-ad-app-create-client-secret-300x162.png 300w, https://zappysys.com/blog/wp-content/uploads/2021/11/azure-ad-app-create-client-secret-768x416.png 768w" sizes="(max-width: 998px) 100vw, 998px" /></a><p id="caption-attachment-9453" class="wp-caption-text">Azure AD App Create Client Secret / Set Name, Expiration Date</p></div></li>
<li>Enter Name for Secret (You can give some friendly name if you create multiple secrets to control multiple processes). For example SecretForTesting, SecretForProduction etc.Select a longer expiration date (i.e. 24 months) if you don&#8217;t like to change secret often in production jobs else choose shorter expiration (i.e. 6 Months or Custom).</li>
<li>Once you Create a Secret make sure you copy it to a secure location. Once the page is closed it won&#8217;t appear again.
<div id="attachment_9454" style="width: 639px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2021/11/azure-ad-app-copy-client-secret-after-create.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9454" class="size-full wp-image-9454" src="https://zappysys.com/blog/wp-content/uploads/2021/11/azure-ad-app-copy-client-secret-after-create.png" alt="Copy Client Secret for Azure AD App" width="629" height="233" srcset="https://zappysys.com/blog/wp-content/uploads/2021/11/azure-ad-app-copy-client-secret-after-create.png 629w, https://zappysys.com/blog/wp-content/uploads/2021/11/azure-ad-app-copy-client-secret-after-create-300x111.png 300w" sizes="(max-width: 629px) 100vw, 629px" /></a><p id="caption-attachment-9454" class="wp-caption-text">Copy Client Secret for Azure AD App</p></div></li>
</ol>
<h2>Associate App User / Set Roles in CRM 365 / Dataverse Environment</h2>
<p>Once we have App Id and Client Secret we can go to CRM Portal to add our App as a valid CRM User. And the last step will be to attach some role(s) to App User (See Next section).</p>
<h3>Method-1 (New way)</h3>
<p>Here are the steps to configure User / Security Roles in New account. Below steps will give you access to Dataverse Entities via API Call. To see all Dataverse Entity you can log in to <a href="https://make.powerapps.com/" target="_blank" rel="noopener">https://make.powerapps.com/</a> and click <strong>Tables</strong></p>
<ol>
<li>Click on the below link to login to new portal to manage CRM /Dataverse environment<br />
<a href="https://admin.powerplatform.microsoft.com/environments" target="_blank" rel="noopener">https://admin.powerplatform.microsoft.com/environments</a></li>
<li>Create an Application User <a href="https://docs.microsoft.com/en-us/power-platform/admin/manage-application-users?WT.mc_id=ppac_inproduct_settings">using these steps</a> (When prompted choose the same App we created in the previous section)</li>
<li>Now Go to App Users Screen and Edit Security Roles using the below steps
<div id="attachment_9579" style="width: 698px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2021/11/powerplatform-crm-365-online-dataverse-view-environments.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9579" class="size-full wp-image-9579" src="https://zappysys.com/blog/wp-content/uploads/2021/11/powerplatform-crm-365-online-dataverse-view-environments.png" alt="See available CRM 365 Online / Datavese Environments" width="688" height="345" srcset="https://zappysys.com/blog/wp-content/uploads/2021/11/powerplatform-crm-365-online-dataverse-view-environments.png 688w, https://zappysys.com/blog/wp-content/uploads/2021/11/powerplatform-crm-365-online-dataverse-view-environments-300x150.png 300w" sizes="(max-width: 688px) 100vw, 688px" /></a><p id="caption-attachment-9579" class="wp-caption-text">See available CRM 365 Online / Datavese Environments</p></div>
<div id="attachment_9580" style="width: 955px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2021/11/powerplatform-crm-365-online-dataverse-view-app-users.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9580" class="size-full wp-image-9580" src="https://zappysys.com/blog/wp-content/uploads/2021/11/powerplatform-crm-365-online-dataverse-view-app-users.png" alt="See available CRM 365 Online / Datavese Application Users" width="945" height="530" srcset="https://zappysys.com/blog/wp-content/uploads/2021/11/powerplatform-crm-365-online-dataverse-view-app-users.png 945w, https://zappysys.com/blog/wp-content/uploads/2021/11/powerplatform-crm-365-online-dataverse-view-app-users-300x168.png 300w, https://zappysys.com/blog/wp-content/uploads/2021/11/powerplatform-crm-365-online-dataverse-view-app-users-768x431.png 768w" sizes="(max-width: 945px) 100vw, 945px" /></a><p id="caption-attachment-9580" class="wp-caption-text">See available CRM 365 Online / Datavese Application Users</p></div>
<div id="attachment_9581" style="width: 1375px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2021/11/powerplatform-crm-365-online-dataverse-select-user-security-roles.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9581" class="size-full wp-image-9581" src="https://zappysys.com/blog/wp-content/uploads/2021/11/powerplatform-crm-365-online-dataverse-select-user-security-roles.png" alt="Edit Security Roles for CRM 365 Online / Datavese Application Users" width="1365" height="581" srcset="https://zappysys.com/blog/wp-content/uploads/2021/11/powerplatform-crm-365-online-dataverse-select-user-security-roles.png 1365w, https://zappysys.com/blog/wp-content/uploads/2021/11/powerplatform-crm-365-online-dataverse-select-user-security-roles-300x128.png 300w, https://zappysys.com/blog/wp-content/uploads/2021/11/powerplatform-crm-365-online-dataverse-select-user-security-roles-768x327.png 768w, https://zappysys.com/blog/wp-content/uploads/2021/11/powerplatform-crm-365-online-dataverse-select-user-security-roles-1024x436.png 1024w" sizes="(max-width: 1365px) 100vw, 1365px" /></a><p id="caption-attachment-9581" class="wp-caption-text">Edit Security Roles for CRM 365 Online / Datavese Application Users</p></div></li>
</ol>
<h3>Method-2 (Legacy)</h3>
<p>If you prefer to use an older interface (and it&#8217;s still available to you) then you can use the below steps to perform the same thing we described in the previous section.</p>
<p>NOTE: Microsoft may soon retire the older interface and force to use the previous way only.</p>
<ol>
<li>To Add our Azure AD App as CRM Application user goto your CRM Portal. Click on <strong>Gear icon</strong> for Settings &gt; <strong>Advanced Settings</strong>
<div id="attachment_9456" style="width: 605px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2021/11/dynamics-crm-advanced-settings.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9456" class="size-full wp-image-9456" src="https://zappysys.com/blog/wp-content/uploads/2021/11/dynamics-crm-advanced-settings.png" alt="Dynamics CRM Advanced Settings" width="595" height="344" srcset="https://zappysys.com/blog/wp-content/uploads/2021/11/dynamics-crm-advanced-settings.png 595w, https://zappysys.com/blog/wp-content/uploads/2021/11/dynamics-crm-advanced-settings-300x173.png 300w" sizes="(max-width: 595px) 100vw, 595px" /></a><p id="caption-attachment-9456" class="wp-caption-text">Dynamics CRM Advanced Settings</p></div></li>
<li>Click on Settings dropdown &gt; <strong>Security</strong> (Under System Column)
<div id="attachment_9457" style="width: 826px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2021/11/dynamics-crm-advanced-security-settings.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9457" class="size-full wp-image-9457" src="https://zappysys.com/blog/wp-content/uploads/2021/11/dynamics-crm-advanced-security-settings.png" alt="Dynamics CRM Security Settings (Under Advanced Settings - System)" width="816" height="438" srcset="https://zappysys.com/blog/wp-content/uploads/2021/11/dynamics-crm-advanced-security-settings.png 816w, https://zappysys.com/blog/wp-content/uploads/2021/11/dynamics-crm-advanced-security-settings-300x161.png 300w, https://zappysys.com/blog/wp-content/uploads/2021/11/dynamics-crm-advanced-security-settings-768x412.png 768w" sizes="(max-width: 816px) 100vw, 816px" /></a><p id="caption-attachment-9457" class="wp-caption-text">Dynamics CRM Security Settings (Under Advanced Settings &#8211; System)</p></div></li>
<li>On the security, screen click on the <strong><strong>Users icon<br />
</strong></strong></p>
<div id="attachment_9458" style="width: 396px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2021/11/dynamics-crm-manage-users.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9458" class="size-full wp-image-9458" src="https://zappysys.com/blog/wp-content/uploads/2021/11/dynamics-crm-manage-users.png" alt="Manage Dynamics CRM Users / Roles (Add, Edit, Delete)" width="386" height="269" srcset="https://zappysys.com/blog/wp-content/uploads/2021/11/dynamics-crm-manage-users.png 386w, https://zappysys.com/blog/wp-content/uploads/2021/11/dynamics-crm-manage-users-300x209.png 300w" sizes="(max-width: 386px) 100vw, 386px" /></a><p id="caption-attachment-9458" class="wp-caption-text">Manage Dynamics CRM Users (Add, Edit, Delete)</p></div></li>
<li>Once User Screen shows up click on the User Type <strong>Dropdown</strong> and choose <strong>Application Users</strong> and click <strong>New</strong>
<div id="attachment_9455" style="width: 425px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2021/11/dynamics-crm-365-add-new-application-user.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9455" class="size-full wp-image-9455" src="https://zappysys.com/blog/wp-content/uploads/2021/11/dynamics-crm-365-add-new-application-user.png" alt="Add new Application User in Dynamics CRM" width="415" height="305" srcset="https://zappysys.com/blog/wp-content/uploads/2021/11/dynamics-crm-365-add-new-application-user.png 415w, https://zappysys.com/blog/wp-content/uploads/2021/11/dynamics-crm-365-add-new-application-user-300x220.png 300w" sizes="(max-width: 415px) 100vw, 415px" /></a><p id="caption-attachment-9455" class="wp-caption-text">Add new Application User in Dynamics CRM</p></div></li>
<li>Once User screen shows up. Enter your <strong>Application Id</strong> (obtained from the Azure AD App &gt; Overview screen &#8211; app created earlier). <strong>Click Save</strong> and you will notice all other fields auto populates.
<div id="attachment_10132" style="width: 681px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2021/11/create-dynamics-crm-application-user-link-azure-ad-app-1.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10132" class="wp-image-10132 size-full" src="https://zappysys.com/blog/wp-content/uploads/2021/11/create-dynamics-crm-application-user-link-azure-ad-app-1.png" alt="create-dynamics-crm-application-user-link-azure-ad-app" width="671" height="835" srcset="https://zappysys.com/blog/wp-content/uploads/2021/11/create-dynamics-crm-application-user-link-azure-ad-app-1.png 671w, https://zappysys.com/blog/wp-content/uploads/2021/11/create-dynamics-crm-application-user-link-azure-ad-app-1-241x300.png 241w" sizes="(max-width: 671px) 100vw, 671px" /></a><p id="caption-attachment-10132" class="wp-caption-text">Adding Azure AD App as Dynamics CRM 365 &#8211; Application User</p></div></li>
<li>And the last step is to Attach some CRM Role to the new Application User.<div class="su-note"  style="border-color:#e5de9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#FFF8B7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;">For demo purposes we will choose &#8220;System Admin&#8221; but for production use, you should grant correct permission carefully. There are many inbuilt roles you can choose from.</div></div>
<div id="attachment_10133" style="width: 893px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2021/11/dynamics-crm-manage-application-user-roles-1.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10133" class="wp-image-10133 size-full" src="https://zappysys.com/blog/wp-content/uploads/2021/11/dynamics-crm-manage-application-user-roles-1.png" alt="dynamics-crm-manage-application-user-roles" width="883" height="766" srcset="https://zappysys.com/blog/wp-content/uploads/2021/11/dynamics-crm-manage-application-user-roles-1.png 883w, https://zappysys.com/blog/wp-content/uploads/2021/11/dynamics-crm-manage-application-user-roles-1-300x260.png 300w, https://zappysys.com/blog/wp-content/uploads/2021/11/dynamics-crm-manage-application-user-roles-1-768x666.png 768w" sizes="(max-width: 883px) 100vw, 883px" /></a><p id="caption-attachment-10133" class="wp-caption-text">Associate Security Role(s) for Dynamics CRM Application User</p></div></li>
</ol>
<h2></h2>
<h2>Find your Organization Id for CRM / Dataverse API calls</h2>
<p>Now find your Org Id before we can call CRM / Dataverse APIs in the next section.</p>
<p>To find your Org Id you can perform the following steps.</p>
<p><strong>Method-1 (New way &#8211; Dataverse Portal)</strong></p>
<ol>
<li>Go to <a href="https://admin.powerplatform.microsoft.com/" target="_blank" rel="noopener">https://admin.powerplatform.microsoft.com/</a></li>
<li>Click on the Environment you like to access</li>
<li>On the Details, page copy your Org Id from the Environment URL For example URL might look like below&#8230; You just need to copy the first part (Use this on CRM Connection &gt; Organization Field)<br />
<span style="text-decoration: underline;"><strong>org8640f7e7</strong></span>.crm.dynamics.com</p>
<div id="attachment_10134" style="width: 752px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2021/11/microsoft-dataverse-crm-api-get-organization-id-1.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10134" class="wp-image-10134 size-full" src="https://zappysys.com/blog/wp-content/uploads/2021/11/microsoft-dataverse-crm-api-get-organization-id-1.png" alt="microsoft-dataverse-crm-api-get-organization-id" width="742" height="424" srcset="https://zappysys.com/blog/wp-content/uploads/2021/11/microsoft-dataverse-crm-api-get-organization-id-1.png 742w, https://zappysys.com/blog/wp-content/uploads/2021/11/microsoft-dataverse-crm-api-get-organization-id-1-300x171.png 300w" sizes="(max-width: 742px) 100vw, 742px" /></a><p id="caption-attachment-10134" class="wp-caption-text">How to find Organization Id for Microsoft Dataverse / CDS / CRM 365 API calls</p></div></li>
</ol>
<p><strong>Method-2 (Old way)</strong></p>
<p>Another way to find your Organization Id is from CRM Portal</p>
<p>If you have multiple environments (i.e. Prod, Sandbox) then each environment might have its own unique URL)</p>
<ol>
<li>To find your API Service URL, Click on <strong>Gear Icon</strong></li>
<li>Choose <strong>Advanced Settings</strong></li>
<li>Click down arrow on <strong>Settings</strong></li>
<li>Click <strong>Customization</strong></li>
<li>Click <strong>Developer Resource</strong> Link</li>
<li>On this page now you can see various URLs. For examples used in this article, we need to get is <strong>Service Root URL</strong> for <strong><strong>Web API</strong></strong>
<div id="attachment_10125" style="width: 730px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/05/dynamics-crm-find-organization-url-soap-web-api-1.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10125" class="wp-image-10125 size-large" src="https://zappysys.com/blog/wp-content/uploads/2019/05/dynamics-crm-find-organization-url-soap-web-api-1-1024x626.png" alt="dynamics-crm-find-organization-url-soap-web-api" width="720" height="440" srcset="https://zappysys.com/blog/wp-content/uploads/2019/05/dynamics-crm-find-organization-url-soap-web-api-1-1024x626.png 1024w, https://zappysys.com/blog/wp-content/uploads/2019/05/dynamics-crm-find-organization-url-soap-web-api-1-300x183.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/05/dynamics-crm-find-organization-url-soap-web-api-1-768x469.png 768w, https://zappysys.com/blog/wp-content/uploads/2019/05/dynamics-crm-find-organization-url-soap-web-api-1.png 1028w" sizes="(max-width: 720px) 100vw, 720px" /></a><p id="caption-attachment-10125" class="wp-caption-text">How to Find Organization Id / Web API URL / SOAP API Service URL (Unique Environment Instance URL)</p></div></li>
</ol>
<h2>Using Client ID (i.e. App Id) and Client Secret to Call Dynamics CRM 365 API / CDS / Dataverse</h2>
<p>That&#8217;s it now we are ready to use this App Id and Client Secret to make CRM API calls.</p>
<p>To confirm if it&#8217;s working you can create a Dynamics CRM Connection (using <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> ). Choose OAuth option on <a href="https://zappysys.com/blog/ssis-dynamics-crm-read-import-crm-365-onpremises/" target="_blank" rel="noopener">Dynamics CRM Connection</a></p>
<div id="attachment_9543" style="width: 899px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2021/11/dyanamics-crm-connection-using-oauth-clientid-connect-dataverse-api.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9543" class="size-full wp-image-9543" src="https://zappysys.com/blog/wp-content/uploads/2021/11/dyanamics-crm-connection-using-oauth-clientid-connect-dataverse-api.png" alt="Connect to Dynamics CRM / Dataverse / PowerApps API using OAuth (Client ID /Secret)" width="889" height="646" srcset="https://zappysys.com/blog/wp-content/uploads/2021/11/dyanamics-crm-connection-using-oauth-clientid-connect-dataverse-api.png 889w, https://zappysys.com/blog/wp-content/uploads/2021/11/dyanamics-crm-connection-using-oauth-clientid-connect-dataverse-api-300x218.png 300w, https://zappysys.com/blog/wp-content/uploads/2021/11/dyanamics-crm-connection-using-oauth-clientid-connect-dataverse-api-768x558.png 768w" sizes="(max-width: 889px) 100vw, 889px" /></a><p id="caption-attachment-9543" class="wp-caption-text">Connect to Dynamics CRM / Dataverse / PowerApps API using OAuth (Client ID /Secret)</p></div>
<h2>Conclusion</h2>
<p>In this article, we saw how to Register Azure AD App to call various Microsoft APIs (for this article we focused mainly on Dynamics CRM 365 API only)</p>
<p>The post <a href="https://zappysys.com/blog/register-app-dynamics-crm-365-cds-dataverse-api-azure-ad-oauth/">How to register App for Dynamics CRM 365 / CDS / Dataverse API (Azure AD / OAuth)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SSIS PowerPack v2.9.5 released (Maintenance Release)</title>
		<link>https://zappysys.com/blog/ssis-powerpack-v2-9-5/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Tue, 25 Jun 2019 13:26:07 +0000</pubDate>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[SSIS Dynamics CRM Destination]]></category>
		<category><![CDATA[SSIS Dynamics CRM Source]]></category>
		<category><![CDATA[SSIS Excel Destination]]></category>
		<category><![CDATA[SSIS Excel Source]]></category>
		<category><![CDATA[SSIS Salesforce Source]]></category>
		<category><![CDATA[SSIS Upsert Destination]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=7292</guid>

					<description><![CDATA[<p>What&#8217;s New In this release we focused on fixing some bugs with Dynamics CRM Source , Dynamics CRM Destination and Reporting Services Task. Version 2.9.6.10621 [Jun 24, 2019] New Features/Improvements NEW: Excel Source &#8211; Add option to read from any sheet by number rather than hard coded table name (e.g. $4$ , $5$ &#8230; ) Bug fixes [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/ssis-powerpack-v2-9-5/">SSIS PowerPack v2.9.5 released (Maintenance Release)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>What&#8217;s New</h2>
<p>In this release we focused on fixing some bugs with <a href="https://zappysys.com/products/ssis-powerpack/ssis-dynamics-crm-source-connector/">Dynamics CRM Source</a> , <a href="https://zappysys.com/products/ssis-powerpack/ssis-dynamics-crm-destination-connector/">Dynamics CRM Destination</a> and <a href="https://zappysys.com/products/ssis-powerpack/ssis-report-generator-task/" target="_blank" rel="noopener">Reporting Services Task</a>.</p>
<h2 class="vertitle">Version 2.9.6.10621 [Jun 24, 2019]</h2>
<h3 class="versubtitle">New Features/Improvements</h3>
<ul>
<li><span class="verAdded">NEW: </span>Excel Source &#8211; Add option to read from any sheet by number rather than hard coded table name (e.g. $4$ , $5$ &#8230; )</li>
</ul>
<h3 class="versubtitle">Bug fixes</h3>
<ul>
<li><span class="verFixed">FIX: </span>Dynamics CRM Destination &#8211; Timeout property is ignored &#8211; You may get error &#8211; The request channel timed out while waiting for a reply after 00:00:59. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding</li>
<li><span class="verFixed">FIX: </span>Dynamics CRM Source &#8211; Virtual Fields not included in output or they are NULL</li>
<li><span class="verFixed">FIX: </span>General &#8211; Sometimes you may see blank OAuth Screen (If error occurred behind the scene)</li>
<li><span class="verFixed">FIX: </span>Reporting Services Task &#8211; LastStatus field not updated</li>
<li><span class="verFixed">FIX: </span>Reporting Services Task &#8211; Local report file throws dll load error at run time</li>
<li><span class="verFixed">FIX: </span>Reporting Services Task &#8211; You may get error on Save UI &#8211; Concurrency violation: the UpdateCommand affected 0 of the expected 1 records</li>
<li><span class="verFixed">FIX: </span>Salesforce Source &#8211; You may get NULL for related Object fields</li>
<li><span class="verFixed">FIX: </span>Upsert Destination &#8211; When you select all columns as Key &#8211; You may get error &#8211; Incorrect syntax near the keyword &#8216;WHEN&#8217;</li>
</ul>
<p>The post <a href="https://zappysys.com/blog/ssis-powerpack-v2-9-5/">SSIS PowerPack v2.9.5 released (Maintenance Release)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SSIS Dynamics CRM / Dataverse &#8211; Read / Import data into SQL Server</title>
		<link>https://zappysys.com/blog/ssis-dynamics-crm-read-import-crm-365-onpremises/</link>
		
		<dc:creator><![CDATA[ZappySys Team]]></dc:creator>
		<pubDate>Tue, 15 May 2018 20:36:40 +0000</pubDate>
				<category><![CDATA[SSIS Dynamics CRM Source]]></category>
		<category><![CDATA[dynamics crm]]></category>
		<category><![CDATA[office 365]]></category>
		<category><![CDATA[ssis]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=3504</guid>

					<description><![CDATA[<p>Introduction Today Microsoft Dynamics CRM / Dataverse (Dynamics 365 / On-Premises CRM / PowerApp) is one of the most popular CRMs in the world. SSIS Dynamics CRM / Dataverse (Dynamics 365 / On-Premises CRM / PowerApp) read operation can be achieved using Dynamics CRM / Dataverse Source Connector. It allows connecting to Dynamics CRM / [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/ssis-dynamics-crm-read-import-crm-365-onpremises/">SSIS Dynamics CRM / Dataverse &#8211; Read / Import data into SQL Server</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/dynamics-crm-365-logo-300x300.png"><img loading="lazy" decoding="async" class=" wp-image-3577 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2018/05/dynamics-crm-365-logo-300x300.png" alt="" width="178" height="160" /></a>Today Microsoft Dynamics CRM / Dataverse (Dynamics 365 / On-Premises CRM / PowerApp) is one of the most popular CRMs in the world. SSIS Dynamics CRM / Dataverse (Dynamics 365 / On-Premises CRM / PowerApp) read operation can be achieved using <a href="https://zappysys.com/products/ssis-powerpack/ssis-dynamics-crm-source-connector/" target="_blank" rel="noopener">Dynamics CRM / Dataverse Source Connector</a>. It allows connecting to <strong>Dynamics CRM / Dataverse 365 Online</strong> or <strong>On-Premises Installation</strong> / <strong>Hosted</strong> CRM instance (IFD &#8211; internet facing deployment). You can read data from Dynamics CRM / Dataverse using SSIS connector and then exports to other sources (e.g. SQL Server, Oracle or Flat File).</p>
<p>In this new article, we will show how to connect and download the Dynamics CRM / Dataverse 365 (Online) data using <a href="https://zappysys.com/products/ssis-powerpack/ssis-dynamics-crm-source-connector/" target="_blank" rel="noopener">Dynamics CRM / Dataverse Source Connector</a>, how to query CRM data using <strong>FetchXML</strong> in SSIS and how to use variables in CRM FetchXML Query.</p>
<p>&nbsp;</p>
<h2>Requirements for SSIS Dynamics CRM / Dataverse (Dynamics 365 / On-Premises CRM / PowerApp) read component</h2>
<ol>
<li>First, you will need SSDT installed</li>
<li>Second, You will need to install <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">ZappySys SSIS PowerPack</a> which includes an SSIS Dynamics CRM / Dataverse Source (Dynamics 365 / On-Premises CRM / PowerApp) task.</li>
<li>Finally, a Microsoft Dynamics account</li>
</ol>
<h2>SSIS Dynamics CRM / Dataverse Source &#8211; Video Tutorial</h2>
[youtube https://www.youtube.com/watch?v=zl0ecdjuLGk?rel=0&amp;showinfo=0&amp;w=560&amp;h=315]
<h2>Getting started with SSIS Dynamics CRM / Dataverse read component</h2>
<h3>Register Dynamics CRM / Dataverse App obtain App Id / Client Secret</h3>
<p>The very first step to access Microsoft Dynamics CRM / Dataverse 365 API is to obtain Application Id (also referred as Client Id)  and Client Secret. We will use this information later in this article (on OAuth connection UI).<br />
<a href="https://zappysys.com/blog/register-app-dynamics-crm-365-cds-dataverse-api-azure-ad-oauth/" target="_blank" rel="noopener">Register Dynamics CRM / Dataverse App With Azure</a> and get the credential (App Id, Client Secret).</p>
<h3>Configure Dynamics CRM / Dataverse Connection</h3>
<ol>
<li>
        In the connection manager, press the new button to create a new connection:</p>
<p>        <div id="attachment_3560" style="width: 756px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/create-a-new-connection.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3560" class="size-full wp-image-3560" src="https://zappysys.com/blog/wp-content/uploads/2018/05/create-a-new-connection.jpg" alt="SSIS create a new connection CRM Dynamics" width="746" height="403" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/create-a-new-connection.jpg 746w, https://zappysys.com/blog/wp-content/uploads/2018/05/create-a-new-connection-300x162.jpg 300w" sizes="(max-width: 746px) 100vw, 746px" /></a><p id="caption-attachment-3560" class="wp-caption-text">SSIS create a new connection CRM Dynamics</p></div>
    </li>
<li>
        Select the ZS-DYNAMICS-CRM Connection.  We will use a CRM Online connection, username, password, and organization:<br />
        <div class="su-note"  style="border-color:#e5de9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#fff8b7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;">NOTE: Please check the Discovery and ORG Service URL are the same as your organization URL. And if you are using Customize URL make sure that you are using it in both Discovery URL as well as in ORG Service URL also.</div></div>
<p>        <div id="attachment_3559" style="width: 775px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2021/11/dyanamics-crm-connection-using-oauth-clientid-connect-dataverse-api.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3559" class="size-full wp-image-3559" src="https://zappysys.com/blog/wp-content/uploads/2021/11/dyanamics-crm-connection-using-oauth-clientid-connect-dataverse-api.png" alt="SSIS Dynamics CRM / Dataverse credentials" width="765" height="633" /></a><p id="caption-attachment-3559" class="wp-caption-text">SSIS Dynamics CRM / Dataverse credentials</p></div>
    </li>
</ol>
<h3>How to create a Dynamics CRM / Dataverse Source</h3>
<ol>
<li>In the control flow, drag and drop the data flow:<img loading="lazy" decoding="async" class="alignnone size-full" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/drag-and-drop-data-flow-task.png" width="460" height="155" /></li>
<li>
        Drag and drop the ZS Dynamics CRM / Dataverse Source:</p>
<p>        <div id="attachment_3510" style="width: 653px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-dynamics-crm-source.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3510" class="size-full wp-image-3510" src="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-dynamics-crm-source.jpg" alt="ssis Dynamics CRM / Dataverse source" width="643" height="392" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-dynamics-crm-source.jpg 643w, https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-dynamics-crm-source-300x183.jpg 300w" sizes="(max-width: 643px) 100vw, 643px" /></a><p id="caption-attachment-3510" class="wp-caption-text">SSIS Dynamics CRM / Dataverse source</p></div>
    </li>
<li>
        Second, select the connection created before and select the account table:</p>
<div id="attachment_3509" style="width: 896px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-entity-table-account.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3509" class="size-full wp-image-3509" src="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-entity-table-account.jpg" alt="ssis entity table account" width="886" height="603" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-entity-table-account.jpg 886w, https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-entity-table-account-300x204.jpg 300w, https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-entity-table-account-768x523.jpg 768w" sizes="(max-width: 886px) 100vw, 886px" /></a><p id="caption-attachment-3509" class="wp-caption-text">SSIS entity table account</p></div>
<p>        &nbsp;
    </li>
</ol>
<h3>Configure SQL Server Destination</h3>
<p>In the following example, we will show how to export the data from the account entity to SQL Server.</p>
<ol>
<li>
        First, drag and drop the OLEDB Destination and join with our ZS CRM Dynamics source:</p>
<p>        <div id="attachment_3516" style="width: 334px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-source-dynamics-sql-destination.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3516" class="size-full wp-image-3516" src="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-source-dynamics-sql-destination.jpg" alt="ssis source dynamics sql destination" width="324" height="202" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-source-dynamics-sql-destination.jpg 324w, https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-source-dynamics-sql-destination-300x187.jpg 300w" sizes="(max-width: 324px) 100vw, 324px" /></a><p id="caption-attachment-3516" class="wp-caption-text">SSIS source dynamics SQL destination</p></div>
    </li>
<li>
        Make sure to select the account table from Dynamics:</p>
<p>        <div id="attachment_3517" style="width: 896px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-entity-table-account-1.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3517" class="size-full wp-image-3517" src="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-entity-table-account-1.jpg" alt="ssis entity table account" width="886" height="603" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-entity-table-account-1.jpg 886w, https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-entity-table-account-1-300x204.jpg 300w, https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-entity-table-account-1-768x523.jpg 768w" sizes="(max-width: 886px) 100vw, 886px" /></a><p id="caption-attachment-3517" class="wp-caption-text">SSIS Dynamics CRM / Dataverse read entity table account</p></div>
    </li>
<li>
        In addition, select an SQL Server and a database. In the name of the table, we will create a table with the following columns:<br />
<pre class="crayon-plain-tag">CREATE TABLE [crm dynamics] (
[accountcategorycode] nvarchar(255),

[accountid] uniqueidentifier,
[accountnumber] nvarchar(20),
[accountratingcode] nvarchar(255),
[accountratingcodename] nvarchar(255),
[address1_addressid] uniqueidentifier,
[address1_city] nvarchar(80),

)</pre>
        <div id="attachment_3548" style="width: 834px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-oledb.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3548" class="size-full wp-image-3548" src="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-oledb.jpg" alt="ssis oledb sql server" width="824" height="719" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-oledb.jpg 824w, https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-oledb-300x262.jpg 300w, https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-oledb-768x670.jpg 768w" sizes="(max-width: 824px) 100vw, 824px" /></a><p id="caption-attachment-3548" class="wp-caption-text">SSIS OLEBD SQL Server</p></div>
    </li>
<li>
        Go to the mapping page to map all the source and destination columns:</p>
<p>        <div id="attachment_3518" style="width: 834px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/dynamics-import-data.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3518" class="wp-image-3518 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/05/dynamics-import-data.jpg" alt="dynamics import data SSIS Dynamics CRM / Dataverse read" width="824" height="663" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/dynamics-import-data.jpg 824w, https://zappysys.com/blog/wp-content/uploads/2018/05/dynamics-import-data-300x241.jpg 300w, https://zappysys.com/blog/wp-content/uploads/2018/05/dynamics-import-data-768x618.jpg 768w" sizes="(max-width: 824px) 100vw, 824px" /></a><p id="caption-attachment-3518" class="wp-caption-text">SSIS Dynamics CRM / Dataverse read mapping</p></div>
    </li>
</ol>
<h3>Load Dynamics CRM / Dataverse Data to SQL Server</h3>
<ol>
<li>
        Execute the package:</p>
<p>        <div id="attachment_3563" style="width: 703px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-start-package.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3563" class="size-full wp-image-3563" src="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-start-package.jpg" alt="ssis start package" width="693" height="79" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-start-package.jpg 693w, https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-start-package-300x34.jpg 300w" sizes="(max-width: 693px) 100vw, 693px" /></a><p id="caption-attachment-3563" class="wp-caption-text">SSIS start package</p></div>
    </li>
<li>Finally, you can see the data exported in SQL Server. Select the data from the CRM Dynamics table:</li>
</ol>
<div id="attachment_3519" style="width: 661px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-results.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3519" class="size-full wp-image-3519" src="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-results.jpg" alt="Data exported from crm to sql server" width="651" height="275" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-results.jpg 651w, https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-results-300x127.jpg 300w" sizes="(max-width: 651px) 100vw, 651px" /></a><p id="caption-attachment-3519" class="wp-caption-text">Data exported from SSIS Dynamic CRM read</p></div>
<h2>How to query Dynamics CRM / Dataverse</h2>
<p>You can query Dynamics CRM / Dataverse data in two modes (Table mode or Query Mode). To use query mode you have to use a special language called <a href="https://msdn.microsoft.com/en-us/library/gg328332.aspx" target="_blank" rel="noopener">FetchXML</a> (sorry no SQL support).  FetchXML is an XML based query language which can be used to SELECT, FILTER, Aggregate, Transform data from CRM. Not all features from traditional SQL Language Found in FetchXML but basic query features can be implemented by writing FetchXML. Here is an example of typical FetchXML.</p><pre class="crayon-plain-tag">&lt;fetch mapping="logical" version="1.0"&gt;
  &lt;entity name="account"&gt;
    &lt;attribute name="accountid" /&gt;
    &lt;attribute name="name" /&gt;
    &lt;attribute name="country" /&gt;
    &lt;filter&gt;
      &lt;condition attribute="country" operator="in"&gt;
        &lt;value&gt;USA&lt;/value&gt;
        &lt;value&gt;UK&lt;/value&gt;
        &lt;value&gt;INDIA&lt;/value&gt;
      &lt;/condition&gt;
      &lt;condition attribute="status" operator="like" value="ACT%" /&gt;
    &lt;/filter&gt;
  &lt;/entity&gt;
&lt;/fetch&gt;</pre><p>
Above FetchXML query is equivalent to below SQL query in traditional RDBMS.</p><pre class="crayon-plain-tag">SELECT accountid,name,country 
FROM account
WHERE country IN ('USA','UK','INDIA') 
AND status LIKE 'ACT%'</pre><p>
&nbsp;</p>
<p>Now let&#8217;s look at how to build FetchXML queries by UI or by Hand.</p>
<p>&nbsp;</p>
<h3>How to generate a FetchXML query using UI</h3>
<ol>
<li>
        The Dynamics CRM / Dataverse portal contains an option to create queries visually that can be exported to XML. To do that use the <strong>Advanced Find</strong> option in the portal:</p>
<p>        <div id="attachment_3564" style="width: 1370px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/dynamics-crm-fetch-xml.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3564" class="size-full wp-image-3564" src="https://zappysys.com/blog/wp-content/uploads/2018/05/dynamics-crm-fetch-xml.jpg" alt="Dynamics CRM / Dataverse fetch xml" width="1360" height="403" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/dynamics-crm-fetch-xml.jpg 1360w, https://zappysys.com/blog/wp-content/uploads/2018/05/dynamics-crm-fetch-xml-300x89.jpg 300w, https://zappysys.com/blog/wp-content/uploads/2018/05/dynamics-crm-fetch-xml-768x228.jpg 768w, https://zappysys.com/blog/wp-content/uploads/2018/05/dynamics-crm-fetch-xml-1024x303.jpg 1024w" sizes="(max-width: 1360px) 100vw, 1360px" /></a><p id="caption-attachment-3564" class="wp-caption-text">Dynamics CRM / Dataverse fetch XML</p></div>
    </li>
<li>
        For example, we will query the Accounts entity where the account name is A. Datum:</p>
<p>        <div id="attachment_3565" style="width: 889px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/dynamics-365-crm-Create-a-query.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3565" class="size-full wp-image-3565" src="https://zappysys.com/blog/wp-content/uploads/2018/05/dynamics-365-crm-Create-a-query.jpg" alt="dynamics 365 crm Create a query" width="879" height="303" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/dynamics-365-crm-Create-a-query.jpg 879w, https://zappysys.com/blog/wp-content/uploads/2018/05/dynamics-365-crm-Create-a-query-300x103.jpg 300w, https://zappysys.com/blog/wp-content/uploads/2018/05/dynamics-365-crm-Create-a-query-768x265.jpg 768w" sizes="(max-width: 879px) 100vw, 879px" /></a><p id="caption-attachment-3565" class="wp-caption-text">dynamics 365 CRM Create a query</p></div>
    </li>
<li>
        Next, we can download the Fetch XML:</p>
<p>        <div id="attachment_3566" style="width: 798px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/dynamics-crm-xml-download.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3566" class="size-full wp-image-3566" src="https://zappysys.com/blog/wp-content/uploads/2018/05/dynamics-crm-xml-download.jpg" alt="Dynamics CRM / Dataverse xml download" width="788" height="312" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/dynamics-crm-xml-download.jpg 788w, https://zappysys.com/blog/wp-content/uploads/2018/05/dynamics-crm-xml-download-300x119.jpg 300w, https://zappysys.com/blog/wp-content/uploads/2018/05/dynamics-crm-xml-download-768x304.jpg 768w" sizes="(max-width: 788px) 100vw, 788px" /></a><p id="caption-attachment-3566" class="wp-caption-text">Dynamics CRM / Dataverse xml download</p></div>
    </li>
</ol>
<p>Let’s check some examples about fetch XML:</p>
<h3>SELECT All Columns (*)</h3>
<p>This example shows how to write a simple FetchXML query to select all columns<br />
of the account entity.</p>
<p>This FetchXML is the equivalent of below SQL</p><pre class="crayon-plain-tag">SELECT * FROM account</pre><p>
The option all-attributes show all the attributes. In this case, of the account entity.</p>
<p>To build custom FetxhXML:<br />
1. Login to your Dynamics CRM / Dataverse Portal<br />
2. Click on Advanced Find icon (Found next to the search textbox)<br />
3. Once done building query, Click on Download FetchXML icon. Copy that XML into Query editor of Dynamics CRM / Dataverse Source.</p>
<p>For more information about FetchXML query syntax check below links :<br />
<a href="https://msdn.microsoft.com/en-us/library/gg328117.aspx">https://msdn.microsoft.com/en-us/library/gg328117.aspx</a><br />
<a href="https://msdn.microsoft.com/en-us/library/gg328332.aspx">https://msdn.microsoft.com/en-us/library/gg328332.aspx</a></p>
<p>For complete syntax and validation rule for FetchXML check below XSD<br />
<a href="https://msdn.microsoft.com/en-us/library/gg309405.aspx">https://msdn.microsoft.com/en-us/library/gg309405.aspx</a></p><pre class="crayon-plain-tag">&lt;fetch mapping='logical' version='1.0'&gt;
 &lt;entity name='account'&gt;
 &lt;all-attributes /&gt;
 &lt;/entity&gt;  
 &lt;/fetch&gt;</pre><p>
<h3>SELECT Specified Columns and Alias with SSIS Dynamics CRM / Dataverse</h3>
<p>This example shows how to write a simple FetchXML query to select two columns and use an alias for column name (e.g. name is renamed to accountname).</p>
<p>This FetchXML is the equivalent of below SQL</p><pre class="crayon-plain-tag">SELECT accountid, name as accountname
FROM account</pre><p>
To build custom FetxhXML<br />
1. Login to your Dynamics CRM / Dataverse Portal<br />
2. Click on Advanced Find icon (Found next to the search textbox)<br />
3. Once done building query, Click on Download FetchXML icon. Copy that XML into Query editor of Dynamics CRM / Dataverse Source.</p>
<p>For more information about FetchXML query syntax check below links :<br />
<a href="https://msdn.microsoft.com/en-us/library/gg328117.aspx">https://msdn.microsoft.com/en-us/library/gg328117.aspx</a><br />
<a href="https://msdn.microsoft.com/en-us/library/gg328332.aspx">https://msdn.microsoft.com/en-us/library/gg328332.aspx</a></p>
<p>For complete syntax and validation rule for FetchXML check below XSD<br />
<a href="https://msdn.microsoft.com/en-us/library/gg309405.aspx">https://msdn.microsoft.com/en-us/library/gg309405.aspx</a></p><pre class="crayon-plain-tag">&lt;fetch mapping='logical'&gt; 
	&lt;entity name='account'&gt;
		&lt;attribute name='accountid'/&gt; 
		&lt;attribute name='name' alias = 'accountname'/&gt; 
	&lt;/entity&gt;
&lt;/fetch&gt;</pre><p>
<h3>WHERE (AND conditions)</h3>
<p>This example shows how to write FetchXML query to filter data using multiple conditions (AND).</p>
<p>This FetchXML is the equivalent of below SQL</p><pre class="crayon-plain-tag">SELECT * FROM account WHERE revenue &gt; 0 AND name like 'A%'</pre><p>
To build custom FetxhXML<br />
1. Login to your Dynamics CRM / Dataverse Portal<br />
2. Click on Advanced Find icon (Found next to the search textbox)<br />
3. Once done building query, Click on Download FetchXML icon. Copy that XML into Query editor of Dynamics CRM / Dataverse Source.<br />
For more information about FetchXML query syntax check below links :<br />
<a href="https://msdn.microsoft.com/en-us/library/gg328117.aspx">https://msdn.microsoft.com/en-us/library/gg328117.aspx</a><br />
<a href="https://msdn.microsoft.com/en-us/library/gg328332.aspx">https://msdn.microsoft.com/en-us/library/gg328332.aspx</a></p>
<p>For complete syntax and validation rule for FetchXML check below XSD<br />
<a href="https://msdn.microsoft.com/en-us/library/gg309405.aspx">https://msdn.microsoft.com/en-us/library/gg309405.aspx</a></p><pre class="crayon-plain-tag">&lt;fetch mapping='logical' version='1.0'&gt;
	&lt;entity name='account'&gt;
		&lt;all-attributes /&gt;
		&lt;filter&gt;
			&lt;condition attribute='revenue' operator='gt' value='0' /&gt;
			&lt;condition attribute='name' operator='like' value='A%' /&gt;
		&lt;/filter&gt;
	&lt;/entity&gt;
&lt;/fetch&gt;</pre><p>
<h3>WHERE (OR conditions)</h3>
<p>This example shows how to write FetchXML query to filter data using multiple conditions (OR).</p>
<p>This FetchXML is the equivalent of below SQL</p><pre class="crayon-plain-tag">SELECT * FROM account WHERE revenue &gt; 0 OR name like 'A%'</pre><p>
To build custom FetxhXML<br />
1. Login to your Dynamics CRM / Dataverse Portal<br />
2. Click on Advanced Find icon (Found next to the search textbox)<br />
3. Once done building query, Click on Download FetchXML icon. Copy that XML into Query editor of Dynamics CRM / Dataverse Source.<br />
For more information about FetchXML query syntax check below links :<br />
<a href="https://msdn.microsoft.com/en-us/library/gg328117.aspx">https://msdn.microsoft.com/en-us/library/gg328117.aspx</a><br />
<a href="https://msdn.microsoft.com/en-us/library/gg328332.aspx">https://msdn.microsoft.com/en-us/library/gg328332.aspx</a></p>
<p>For complete syntax and validation rule for FetchXML check below XSD<br />
<a href="https://msdn.microsoft.com/en-us/library/gg309405.aspx">https://msdn.microsoft.com/en-us/library/gg309405.aspx</a></p><pre class="crayon-plain-tag">&lt;fetch mapping='logical' version='1.0'&gt;
	&lt;entity name='account'&gt;
		&lt;all-attributes /&gt;
		&lt;filter type='or'&gt;
			&lt;condition attribute='revenue' operator='gt' value='0' /&gt;
			&lt;condition attribute='name' operator='like' value='A%' /&gt;
		&lt;/filter&gt;
	&lt;/entity&gt;
&lt;/fetch&gt;</pre><p>
<h3>WHERE (Mixing AND / OR conditions)</h3>
<p>This example shows how to write FetchXML query to filter data using multiple conditions (Mixing AND / OR).</p>
<p>This FetchXML is the equivalent of below SQL</p><pre class="crayon-plain-tag">SELECT * FROM account 
WHERE revenue &gt; 0 AND
    (
     name LIKE 'A%' OR 
     name LIKE 'B%'
    )</pre><p>
To build custom FetxhXML<br />
1. Login to your Dynamics CRM / Dataverse Portal<br />
2. Click on Advanced Find icon (Found next to the search textbox)<br />
3. Once done building query, Click on Download FetchXML icon. Copy that XML into Query editor of Dynamics CRM / Dataverse Source.<br />
For more information about FetchXML query syntax check below links :<br />
<a href="https://msdn.microsoft.com/en-us/library/gg328117.aspx">https://msdn.microsoft.com/en-us/library/gg328117.aspx</a><br />
<a href="https://msdn.microsoft.com/en-us/library/gg328332.aspx">https://msdn.microsoft.com/en-us/library/gg328332.aspx</a></p>
<p>For complete syntax and validation rule for FetchXML check below XSD<br />
<a href="https://msdn.microsoft.com/en-us/library/gg309405.aspx">https://msdn.microsoft.com/en-us/library/gg309405.aspx</a></p><pre class="crayon-plain-tag">&lt;fetch mapping='logical' version='1.0'&gt;
	&lt;entity name='account'&gt;
		&lt;all-attributes /&gt;
		&lt;filter&gt;
			&lt;condition attribute='revenue' operator='gt' value='0' /&gt;
			&lt;filter type='or'&gt;
				&lt;condition attribute='name' operator='like' value='A%' /&gt;
				&lt;condition attribute='name' operator='like' value='B%' /&gt;
			&lt;/filter&gt;
		&lt;/filter&gt;
	&lt;/entity&gt;
&lt;/fetch&gt;</pre><p>
<h3>SELECT DISTINCT (Exclude duplicates)</h3>
<p>This example shows how to write FetchXML query to get distinct records (exclude duplicates).</p>
<p>This FetchXML is the equivalent of below SQL</p><pre class="crayon-plain-tag">SELECT DISTINCT accountid,name FROM account</pre><p>
To build custom FetxhXML<br />
1. Login to your Dynamics CRM / Dataverse Portal<br />
2. Click on Advanced Find icon (Found next to the search textbox)<br />
3. Once done building query, Click on Download FetchXML icon. Copy that XML into Query editor of Dynamics CRM / Dataverse Source.</p>
<p>For more information about FetchXML query syntax check below links:<br />
<a href="https://msdn.microsoft.com/en-us/library/gg328117.aspx">https://msdn.microsoft.com/en-us/library/gg328117.aspx</a><br />
<a href="https://msdn.microsoft.com/en-us/library/gg328332.aspx">https://msdn.microsoft.com/en-us/library/gg328332.aspx</a></p>
<p>For complete syntax and validation rule for FetchXML check below XSD<br />
<a href="https://msdn.microsoft.com/en-us/library/gg309405.aspx">https://msdn.microsoft.com/en-us/library/gg309405.aspx</a></p><pre class="crayon-plain-tag">&lt;fetch mapping='logical' distinct='true' version='1.0'&gt;
	&lt;entity name='account'&gt; 
		&lt;attribute name='accountid' /&gt;
		&lt;attribute name='name' /&gt;
	&lt;/entity&gt;
&lt;/fetch&gt;</pre><p>
<h3>SELECT TOP using SSIS Dynamics CRM / Dataverse read</h3>
<p>This example shows how to write FetchXML query to select TOP N rows. This setting may not work if you using preview mode.</p>
<p>This FetchXML is the equivalent of below SQL</p><pre class="crayon-plain-tag">SELECT TOP 10 * FROM account</pre><p>
To build custom FetxhXML<br />
1. Login to your Dynamics CRM / Dataverse Portal<br />
2. Click on Advanced Find icon (Found next to the search textbox)<br />
3. Once done building query, Click on Download FetchXML icon. Copy that XML into Query editor of Dynamics CRM / Dataverse Source.</p>
<p>For more information about FetchXML query syntax check below links :<br />
<a href="https://msdn.microsoft.com/en-us/library/gg328117.aspx">https://msdn.microsoft.com/en-us/library/gg328117.aspx</a><br />
<a href="https://msdn.microsoft.com/en-us/library/gg328332.aspx">https://msdn.microsoft.com/en-us/library/gg328332.aspx</a></p>
<p>For complete syntax and validation rule for FetchXML check below XSD<br />
<a href="https://msdn.microsoft.com/en-us/library/gg309405.aspx">https://msdn.microsoft.com/en-us/library/gg309405.aspx</a></p><pre class="crayon-plain-tag">&lt;fetch mapping='logical' count='10' version='1.0'&gt;
  &lt;entity name='account'&gt;
    &lt;all-attributes /&gt;
  &lt;/entity&gt;
&lt;/fetch&gt;</pre><p>
<h3>GROUP BY / Aggregate functions</h3>
<p>This example shows how to use aggregate functions such as SUM, MIN, MAX, AVG along with GROUP BY clause. When you use the Aggregate function in SQL Query you can also use an alias for the field. Refer FetchXML help to learn more about aggregate functions.</p>
<p>This FetchXML is the equivalent of below SQL</p><pre class="crayon-plain-tag">SELECT AVG(estimatedvalue) AS estimatedvalue_avg, COUNT(name) AS opportunity_count, ownerid AS ownerid
FROM opportunity 
GROUP BY ownerid</pre><p>
You can use COUNT, COUNT(attribute_name), SUM, MIN, MAX, AVG as an aggregate function</p>
<p>To build custom FetxhXML<br />
1. Login to your Dynamics CRM / Dataverse Portal<br />
2. Click on Advanced Find icon (Found next to the search textbox)<br />
3. Once done building query, Click on Download FetchXML icon. Copy that XML into Query editor of Dynamics CRM / Dataverse Source.</p>
<p>For more information about FetchXML query syntax check below links :<br />
<a href="https://msdn.microsoft.com/en-us/library/gg328117.aspx">https://msdn.microsoft.com/en-us/library/gg328117.aspx</a><br />
<a href="https://msdn.microsoft.com/en-us/library/gg328332.aspx">https://msdn.microsoft.com/en-us/library/gg328332.aspx</a></p>
<p>For complete syntax and validation rule for FetchXML check below XSD<br />
<a href="https://msdn.microsoft.com/en-us/library/gg309405.aspx">https://msdn.microsoft.com/en-us/library/gg309405.aspx</a></p><pre class="crayon-plain-tag">&lt;fetch distinct='false' mapping='logical' aggregate='true'&gt; 
    &lt;entity name='opportunity'&gt; 
       &lt;attribute name='estimatedvalue' aggregate='avg' alias='estimatedvalue_avg'  /&gt; 
       &lt;attribute name='name' aggregate='countcolumn' alias='opportunity_count' /&gt; 
       &lt;attribute name='ownerid' alias='ownerid' groupby='true' /&gt; 
    &lt;/entity&gt; 
&lt;/fetch&gt;</pre><p>
<h3>INNER JOIN (matching child records)</h3>
<p>This example shows how to write FetchXML query to get account and associated contacts where email is @gmail.com or yahoo.com or hotmail.com and revenue for account is &gt; 10000.</p>
<p>This FetchXML is the equivalent of below SQL</p><pre class="crayon-plain-tag">SELECT a.name, c.firstname, c.lastname, c.email
FROM account a
INNER JOIN contact c ON a.accountid=c.parentcustomerid
                     AND (c.email LIKE '%@yahoo.com'
                          OR c.email LIKE '%@gmail.com'
                          OR c.email LIKE '%@hotmail.com')
WHERE a.revenue &gt; 10000</pre><p>
To build custom FetxhXML<br />
1. Login to your Dynamics CRM / Dataverse Portal<br />
2. Click on Advanced Find icon (Found next to the search textbox)<br />
3. Once done building query, Click on Download FetchXML icon. Copy that XML into Query editor of Dynamics CRM / Dataverse Source.</p>
<p>For more information about FetchXML query syntax check below links :<br />
<a href="https://msdn.microsoft.com/en-us/library/gg328117.aspx">https://msdn.microsoft.com/en-us/library/gg328117.aspx</a><br />
<a href="https://msdn.microsoft.com/en-us/library/gg328332.aspx">https://msdn.microsoft.com/en-us/library/gg328332.aspx</a></p>
<p>For complete syntax and validation rule for FetchXML check below XSD<br />
<a href="https://msdn.microsoft.com/en-us/library/gg309405.aspx">https://msdn.microsoft.com/en-us/library/gg309405.aspx</a></p><pre class="crayon-plain-tag">&lt;fetch mapping='logical' version='1.0'&gt;
  &lt;entity name='account'&gt;
    &lt;attribute name='name' /&gt;
    &lt;filter&gt;
      &lt;condition attribute='revenue' operator='gt' value='10000' /&gt;
    &lt;/filter&gt;
    &lt;link-entity name='contact' from='parentcustomerid' to='accountid' alias='c' link-type='inner'&gt;
      &lt;attribute name='firstname' /&gt;
      &lt;attribute name='lastname' /&gt;
      &lt;attribute name='email' /&gt;
      &lt;filter type='or'&gt;
        &lt;condition attribute='email' operator='like' value='%@yahoo.com' /&gt;
        &lt;filter type='or'&gt;
          &lt;condition attribute='email' operator='like' value='%@gmail.com' /&gt;
          &lt;condition attribute='email' operator='like' value='%@hotmail.com' /&gt;
        &lt;/filter&gt;
      &lt;/filter&gt;
    &lt;/link-entity&gt;
  &lt;/entity&gt;
&lt;/fetch&gt;</pre><p>
<h3>LEFT OUTER JOIN (&#8216;not in&#8217; type query)</h3>
<p>This example shows how to write FetchXML query to find all leads that have no tasks, using an alias.</p>
<p>This FetchXML is the equivalent of below SQL</p><pre class="crayon-plain-tag">SELECT lead.FullName
FROM Leads as lead
LEFT OUTER JOIN Tasks as ab
    ON (lead.leadId  =  ab.RegardingObjectId)
WHERE ab.RegardingObjectId is null</pre><p>
For more information on left outer join syntax check below link<br />
<a href="https://msdn.microsoft.com/en-us/library/dn531006.aspx">https://msdn.microsoft.com/en-us/library/dn531006.aspx</a></p>
<p>To build custom FetxhXML<br />
1. Login to your Dynamics CRM / Dataverse Portal<br />
2. Click on Advanced Find icon (Found next to the search textbox)<br />
3. Once done building query, Click on Download FetchXML icon. Copy that XML into Query editor of Dynamics CRM / Dataverse Source.</p>
<p>For more information about FetchXML query syntax check below links :<br />
<a href="https://msdn.microsoft.com/en-us/library/gg328117.aspx">https://msdn.microsoft.com/en-us/library/gg328117.aspx</a><br />
<a href="https://msdn.microsoft.com/en-us/library/gg328332.aspx">https://msdn.microsoft.com/en-us/library/gg328332.aspx</a></p>
<p>For complete syntax and validation rule for FetchXML check below XSD<br />
<a href="https://msdn.microsoft.com/en-us/library/gg309405.aspx">https://msdn.microsoft.com/en-us/library/gg309405.aspx</a></p><pre class="crayon-plain-tag">&lt;fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'&gt;
  &lt;entity name='lead'&gt;
    &lt;attribute name='fullname' /&gt;
    &lt;link-entity name='task' from='regardingobjectid' to='leadid' alias='ab' link-type='outer'&gt;
       &lt;attribute name='regardingobjectid' /&gt;
    &lt;/link-entity&gt;
    &lt;filter type='and'&gt;
        &lt;condition entityname='ab' attribute='regardingobjectid' operator='null' /&gt;
    &lt;/filter&gt;
  &lt;/entity&gt;
&lt;fetch/&gt;</pre><p>
<h3>ORDER BY</h3>
<p>This example shows how to write FetchXML query with order by specified for one or more attributes.</p>
<p>This FetchXML is the equivalent of below SQL</p><pre class="crayon-plain-tag">SELECT firstname, lastname, email FROM contact
ORDER BY lastname ASC, firstname DESC</pre><p>
To build custom FetxhXML<br />
1. Login to your Dynamics CRM / Dataverse Portal<br />
2. Click on Advanced Find icon (Found next to the search textbox)<br />
3. Once done building query, Click on Download FetchXML icon. Copy that XML into Query editor of Dynamics CRM / Dataverse Source.</p>
<p>For more information about FetchXML query syntax check below links :<br />
<a href="https://msdn.microsoft.com/en-us/library/gg328117.aspx">https://msdn.microsoft.com/en-us/library/gg328117.aspx</a><br />
<a href="https://msdn.microsoft.com/en-us/library/gg328332.aspx">https://msdn.microsoft.com/en-us/library/gg328332.aspx</a></p>
<p>For complete syntax and validation rule for FetchXML check below XSD<br />
<a href="https://msdn.microsoft.com/en-us/library/gg309405.aspx">https://msdn.microsoft.com/en-us/library/gg309405.aspx</a></p><pre class="crayon-plain-tag">&lt;fetch mapping='logical' version='1.0'&gt;
  &lt;entity name='contact'&gt;
    &lt;attribute name='firstname' /&gt;
    &lt;attribute name='lastname' /&gt;
    &lt;attribute name='email' /&gt;
    &lt;order attribute='lastname' /&gt;
    &lt;order attribute='firstname' descending='true' /&gt;
  &lt;/entity&gt;
&lt;/fetch&gt;</pre><p>
<h3>OPERATOR &#8211; Equal ( = )</h3>
<p>This example shows how to write FetchXML query using equal operator.</p>
<p>This FetchXML is the equivalent of below SQL</p><pre class="crayon-plain-tag">SELECT name FROM account WHERE revenue=0</pre><p>
For a list of supported operators check below XSD and search for name=&#8221;operator&#8221;<br />
<a href="https://msdn.microsoft.com/en-us/library/gg309405.aspx">https://msdn.microsoft.com/en-us/library/gg309405.aspx</a></p>
<p>To build custom FetxhXML<br />
1. Login to your Dynamics CRM / Dataverse Portal<br />
2. Click on Advanced Find icon (Found next to the search textbox)<br />
3. Once done building query, Click on Download FetchXML icon. Copy that XML into Query editor of Dynamics CRM / Dataverse Source.</p>
<p>For more information about FetchXML query syntax check below links :<br />
<a href="https://msdn.microsoft.com/en-us/library/gg328117.aspx">https://msdn.microsoft.com/en-us/library/gg328117.aspx</a><br />
<a href="https://msdn.microsoft.com/en-us/library/gg328332.aspx">https://msdn.microsoft.com/en-us/library/gg328332.aspx</a></p>
<p>For complete syntax and validation rule for FetchXML check below XSD<br />
<a href="https://msdn.microsoft.com/en-us/library/gg309405.aspx">https://msdn.microsoft.com/en-us/library/gg309405.aspx</a></p><pre class="crayon-plain-tag">&lt;fetch mapping='logical' version='1.0'&gt;
  &lt;entity name='account'&gt;
    &lt;attribute name='name' /&gt;
    &lt;filter&gt;
      &lt;condition attribute='revenue' operator='eq' value='0' /&gt;
    &lt;/filter&gt;
  &lt;/entity&gt;
&lt;/fetch</pre><p>
<h3>OPERATOR &#8211; Not Equal ( != )</h3>
<p>This example shows how to write FetchXML query using not equal operator.</p>
<p>This FetchXML is the equivalent of below SQL</p><pre class="crayon-plain-tag">SELECT name FROM account WHERE revenue != 0</pre><p>
For a list of supported operators check below XSD and search for name=&#8221;operator&#8221;<br />
<a href="https://msdn.microsoft.com/en-us/library/gg309405.aspx">https://msdn.microsoft.com/en-us/library/gg309405.aspx</a></p>
<p>To build custom FetxhXML<br />
1. Login to your Dynamics CRM / Dataverse Portal<br />
2. Click on Advanced Find icon (Found next to the search textbox)<br />
3. Once done building query, Click on Download FetchXML icon. Copy that XML into Query editor of Dynamics CRM / Dataverse Source.</p>
<p>For more information about FetchXML query syntax check below links :<br />
<a href="https://msdn.microsoft.com/en-us/library/gg328117.aspx">https://msdn.microsoft.com/en-us/library/gg328117.aspx</a><br />
<a href="https://msdn.microsoft.com/en-us/library/gg328332.aspx">https://msdn.microsoft.com/en-us/library/gg328332.aspx</a></p>
<p>For complete syntax and validation rule for FetchXML check below XSD<br />
<a href="https://msdn.microsoft.com/en-us/library/gg309405.aspx">https://msdn.microsoft.com/en-us/library/gg309405.aspx</a></p><pre class="crayon-plain-tag">&lt;fetch mapping='logical' version='1.0'&gt;
  &lt;entity name='account'&gt;
    &lt;attribute name='name' /&gt;
    &lt;filter&gt;
      &lt;condition attribute='revenue' operator='ne' value='0' /&gt;
    &lt;/filter&gt;
  &lt;/entity&gt;
&lt;/fetch&gt;</pre><p>
<h3>OPERATOR &#8211; Greater Than ( &gt; )</h3>
<p>This example shows how to write FetchXML query using greater than the operator.</p>
<p>This FetchXML is the equivalent of below SQL</p><pre class="crayon-plain-tag">SELECT name FROM account WHERE revenue &gt; 0</pre><p>
For a list of supported operators check below XSD and search for name=&#8221;operator&#8221;<br />
<a href="https://msdn.microsoft.com/en-us/library/gg309405.aspx">https://msdn.microsoft.com/en-us/library/gg309405.aspx</a></p>
<p>To build custom FetxhXML<br />
1. Login to your Dynamics CRM / Dataverse Portal<br />
2. Click on Advanced Find icon (Found next to the search textbox)<br />
3. Once done building query, Click on Download FetchXML icon. Copy that XML into Query editor of Dynamics CRM / Dataverse Source.</p>
<p>For more information about FetchXML query syntax check below links :<br />
<a href="https://msdn.microsoft.com/en-us/library/gg328117.aspx">https://msdn.microsoft.com/en-us/library/gg328117.aspx</a><br />
<a href="https://msdn.microsoft.com/en-us/library/gg328332.aspx">https://msdn.microsoft.com/en-us/library/gg328332.aspx</a></p>
<p>For complete syntax and validation rule for FetchXML check below XSD<br />
<a href="https://msdn.microsoft.com/en-us/library/gg309405.aspx">https://msdn.microsoft.com/en-us/library/gg309405.aspx</a></p><pre class="crayon-plain-tag">&lt;fetch mapping='logical' version='1.0'&gt;
  &lt;entity name='account'&gt;
    &lt;attribute name='name' /&gt;
    &lt;filter&gt;
      &lt;condition attribute='revenue' operator='gt' value='0' /&gt;
    &lt;/filter&gt;
  &lt;/entity&gt;
&lt;/fetch&gt;</pre><p>
<h3>OPERATOR &#8211; Less Than ( &lt; )</h3>
<p>This example shows how to write FetchXML query using greater than the operator.</p>
<p>This FetchXML is the equivalent of below SQL</p><pre class="crayon-plain-tag">SELECT name FROM account WHERE revenue &lt; 0</pre><p>
For a list of supported operators check below XSD and search for name=&#8221;operator&#8221;<br />
<a href="https://msdn.microsoft.com/en-us/library/gg309405.aspx">https://msdn.microsoft.com/en-us/library/gg309405.aspx</a></p>
<p>To build custom FetxhXML<br />
1. Login to your Dynamics CRM / Dataverse Portal<br />
2. Click on Advanced Find icon (Found next to the search textbox)<br />
3. Once done building query, Click on Download FetchXML icon. Copy that XML into Query editor of Dynamics CRM / Dataverse Source.</p>
<p>For more information about FetchXML query syntax check below links :<br />
<a href="https://msdn.microsoft.com/en-us/library/gg328117.aspx">https://msdn.microsoft.com/en-us/library/gg328117.aspx</a><br />
<a href="https://msdn.microsoft.com/en-us/library/gg328332.aspx">https://msdn.microsoft.com/en-us/library/gg328332.aspx</a></p>
<p>For complete syntax and validation rule for FetchXML check below XSD<br />
<a href="https://msdn.microsoft.com/en-us/library/gg309405.aspx">https://msdn.microsoft.com/en-us/library/gg309405.aspx</a></p><pre class="crayon-plain-tag">&lt;fetch mapping='logical' version='1.0'&gt;
  &lt;entity name='account'&gt;
    &lt;attribute name='name' /&gt;
    &lt;filter&gt;
      &lt;condition attribute='revenue' operator='lt' value='0' /&gt;
    &lt;/filter&gt;
  &lt;/entity&gt;
&lt;/fetch&gt;</pre><p>
<h3>OPERATOR &#8211; IN (Check for multiple matching values)</h3>
<p>This example shows how to write FetchXML query to find multiple matching values using IN operator.</p>
<p>This FetchXML is the equivalent of below SQL</p><pre class="crayon-plain-tag">SELECT name FROM account WHERE name IN ('Microsoft', 'Yahoo', 'Google')</pre><p>
For a list of supported operators check below XSD and search for name=&#8221;operator&#8221;<br />
<a href="https://msdn.microsoft.com/en-us/library/gg309405.aspx">https://msdn.microsoft.com/en-us/library/gg309405.aspx</a></p>
<p>To build custom FetxhXML<br />
1. Login to your Dynamics CRM / Dataverse Portal<br />
2. Click on Advanced Find icon (Found next to the search textbox)<br />
3. Once done building query, Click on Download FetchXML icon. Copy that XML into Query editor of Dynamics CRM / Dataverse Source.</p>
<p>For more information about FetchXML query syntax check below links :<br />
<a href="https://msdn.microsoft.com/en-us/library/gg328117.aspx">https://msdn.microsoft.com/en-us/library/gg328117.aspx</a><br />
<a href="https://msdn.microsoft.com/en-us/library/gg328332.aspx">https://msdn.microsoft.com/en-us/library/gg328332.aspx</a></p>
<p>For complete syntax and validation rule for FetchXML check below XSD<br />
<a href="https://msdn.microsoft.com/en-us/library/gg309405.aspx">https://msdn.microsoft.com/en-us/library/gg309405.aspx</a></p><pre class="crayon-plain-tag">&lt;fetch mapping='logical' version='1.0'&gt;
  &lt;entity name='account'&gt;
    &lt;attribute name='name' /&gt;
    &lt;filter&gt;
      &lt;condition attribute='name' operator='in'&gt;
        &lt;value&gt;Microsoft&lt;/value&gt;
        &lt;value&gt;Yahoo&lt;/value&gt;
        &lt;value&gt;Google&lt;/value&gt;
      &lt;/condition&gt;
    &lt;/filter&gt;
  &lt;/entity&gt;
&lt;/fetch&gt;</pre><p>
<h3>OPERATOR &#8211; NULL (Check for NULL values)</h3>
<p>This example shows how to write FetchXML query to find NULL values (search for records where email not specified).</p>
<p>This FetchXML is the equivalent of below SQL</p><pre class="crayon-plain-tag">SELECT firstname, lastname, email FROM contact WHERE email is NULL</pre><p>
For a list of supported operators check below XSD and search for name=&#8221;operator&#8221;<br />
<a href="https://msdn.microsoft.com/en-us/library/gg309405.aspx">https://msdn.microsoft.com/en-us/library/gg309405.aspx</a></p>
<p>To build custom FetxhXML<br />
1. Login to your Dynamics CRM / Dataverse Portal<br />
2. Click on Advanced Find icon (Found next to the search textbox)<br />
3. Once done building query, Click on Download FetchXML icon. Copy that XML into Query editor of Dynamics CRM / Dataverse Source.</p>
<p>For more information about FetchXML query syntax check below links :<br />
<a href="https://msdn.microsoft.com/en-us/library/gg328117.aspx">https://msdn.microsoft.com/en-us/library/gg328117.aspx</a><br />
<a href="https://msdn.microsoft.com/en-us/library/gg328332.aspx">https://msdn.microsoft.com/en-us/library/gg328332.aspx</a></p>
<p>For complete syntax and validation rule for FetchXML check below XSD<br />
<a href="https://msdn.microsoft.com/en-us/library/gg309405.aspx">https://msdn.microsoft.com/en-us/library/gg309405.aspx</a></p><pre class="crayon-plain-tag">&lt;fetch mapping='logical' version='1.0'&gt;
  &lt;entity name='contact'&gt;
    &lt;attribute name='firstname' /&gt;
    &lt;attribute name='lastname' /&gt;
    &lt;attribute name='email' /&gt;	
    &lt;filter&gt;
      &lt;condition attribute='email' operator='null' /&gt;
    &lt;/filter&gt;
  &lt;/entity&gt;
&lt;/fetch&gt;</pre><p>
<h3>OPERATOR &#8211; NOT NULL (Check for NOT NULL values)</h3>
<p>This example shows how to write FetchXML query to find NOT NULL values (search for records where email not specified).</p>
<p>This FetchXML is the equivalent of below SQL</p><pre class="crayon-plain-tag">SELECT firstname, lastname, email FROM contact WHERE email is NOT NULL</pre><p>
For a list of supported operators check below XSD and search for name=&#8221;operator&#8221;<br />
<a href="https://msdn.microsoft.com/en-us/library/gg309405.aspx">https://msdn.microsoft.com/en-us/library/gg309405.aspx</a></p>
<p>To build custom FetxhXML<br />
1. Login to your Dynamics CRM / Dataverse Portal<br />
2. Click on Advanced Find icon (Found next to the search textbox)<br />
3. Once done building query, Click on Download FetchXML icon. Copy that XML into Query editor of Dynamics CRM / Dataverse Source.</p>
<p>For more information about FetchXML query syntax check below links :<br />
<a href="https://msdn.microsoft.com/en-us/library/gg328117.aspx">https://msdn.microsoft.com/en-us/library/gg328117.aspx</a><br />
<a href="https://msdn.microsoft.com/en-us/library/gg328332.aspx">https://msdn.microsoft.com/en-us/library/gg328332.aspx</a></p>
<p>For complete syntax and validation rule for FetchXML check below XSD<br />
<a href="https://msdn.microsoft.com/en-us/library/gg309405.aspx">https://msdn.microsoft.com/en-us/library/gg309405.aspx</a></p><pre class="crayon-plain-tag">&lt;fetch mapping='logical' version='1.0'&gt;
  &lt;entity name='contact'&gt;
    &lt;attribute name='firstname' /&gt;
    &lt;attribute name='lastname' /&gt;
    &lt;attribute name='email' /&gt;	
    &lt;filter&gt;
      &lt;condition attribute='email' operator='not-null' /&gt;
    &lt;/filter&gt;
  &lt;/entity&gt;
&lt;/fetch&gt;</pre><p>
<h3>OPERATOR &#8211; LIKE (Pattern search)</h3>
<p>This example shows how to write FetchXML query using LIKE operator to match string by pattern search.</p>
<p>This FetchXML is the equivalent of below SQL</p><pre class="crayon-plain-tag">SELECT name FROM account WHERE name LIKE 'zappy%'</pre><p>
For a list of supported operators check below XSD and search for name=&#8221;operator&#8221;<br />
<a href="https://msdn.microsoft.com/en-us/library/gg309405.aspx">https://msdn.microsoft.com/en-us/library/gg309405.aspx</a></p>
<p>To build custom FetxhXML<br />
1. Login to your Dynamics CRM / Dataverse Portal<br />
2. Click on Advanced Find icon (Found next to the search textbox)<br />
3. Once done building query, Click on Download FetchXML icon. Copy that XML into Query editor of Dynamics CRM / Dataverse Source.</p>
<p>For more information about FetchXML query syntax check below links :<br />
<a href="https://msdn.microsoft.com/en-us/library/gg328117.aspx">https://msdn.microsoft.com/en-us/library/gg328117.aspx</a><br />
<a href="https://msdn.microsoft.com/en-us/library/gg328332.aspx">https://msdn.microsoft.com/en-us/library/gg328332.aspx</a></p>
<p>For complete syntax and validation rule for FetchXML check below XSD<br />
<a href="https://msdn.microsoft.com/en-us/library/gg309405.aspx">https://msdn.microsoft.com/en-us/library/gg309405.aspx</a></p><pre class="crayon-plain-tag">&lt;fetch mapping='logical' version='1.0'&gt;
  &lt;entity name='account'&gt;
    &lt;attribute name='name' /&gt;
    &lt;filter&gt;
      &lt;condition attribute='name' operator='like' value='zappy%' /&gt;
    &lt;/filter&gt;
  &lt;/entity&gt;
&lt;/fetch&gt;</pre><p>
<h3>OPERATOR &#8211; NOT LIKE (Pattern search)</h3>
<p>This example shows how to write FetchXML query using LIKE operator to match string by pattern search.</p>
<p>This FetchXML is the equivalent of below SQL</p><pre class="crayon-plain-tag">SELECT name FROM account WHERE name NOT LIKE 'zappy%'</pre><p>
For a list of supported operators check below XSD and search for name=&#8221;operator&#8221;<br />
<a href="https://msdn.microsoft.com/en-us/library/gg309405.aspx">https://msdn.microsoft.com/en-us/library/gg309405.aspx</a></p>
<p>To build custom FetxhXML<br />
1. Login to your Dynamics CRM / Dataverse Portal<br />
2. Click on Advanced Find icon (Found next to the search textbox)<br />
3. Once done building query, Click on Download FetchXML icon. Copy that XML into Query editor of Dynamics CRM / Dataverse Source.</p>
<p>For more information about FetchXML query syntax check below links :<br />
<a href="https://msdn.microsoft.com/en-us/library/gg328117.aspx">https://msdn.microsoft.com/en-us/library/gg328117.aspx</a><br />
<a href="https://msdn.microsoft.com/en-us/library/gg328332.aspx">https://msdn.microsoft.com/en-us/library/gg328332.aspx</a></p>
<p>For complete syntax and validation rule for FetchXML check below XSD<br />
<a href="https://msdn.microsoft.com/en-us/library/gg309405.aspx">https://msdn.microsoft.com/en-us/library/gg309405.aspx</a></p><pre class="crayon-plain-tag">&lt;fetch mapping='logical' version='1.0'&gt;
  &lt;entity name='account'&gt;
    &lt;attribute name='name' /&gt;
    &lt;filter&gt;
      &lt;condition attribute='name' operator='not-like' value='zappy%' /&gt;
    &lt;/filter&gt;
  &lt;/entity&gt;
&lt;/fetch&gt;</pre><p>
<h3>OPERATOR &#8211; UNDER (Find all children for given hierarchy) with the SSIS Dynamics CRM / Dataverse read task</h3>
<p>This example shows how to write FetchXML query to get children count for a given hierarchy.</p>
<p>For more information about querying hierarchical data check below link<br />
<a href="https://msdn.microsoft.com/en-us/library/dn817893.aspx">https://msdn.microsoft.com/en-us/library/dn817893.aspx</a></p>
<p>For a list of supported operators check below XSD and search for name=&#8221;operator&#8221;<br />
<a href="https://msdn.microsoft.com/en-us/library/gg309405.aspx">https://msdn.microsoft.com/en-us/library/gg309405.aspx</a></p>
<p>To build custom FetxhXML<br />
1. Login to your Dynamics CRM / Dataverse Portal<br />
2. Click on Advanced Find icon (Found next to the search textbox)<br />
3. Once done building query, Click on Download FetchXML icon. Copy that XML into Query editor of Dynamics CRM / Dataverse Source.</p>
<p>For more information about FetchXML query syntax check below links :<br />
<a href="https://msdn.microsoft.com/en-us/library/gg328117.aspx">https://msdn.microsoft.com/en-us/library/gg328117.aspx</a><br />
<a href="https://msdn.microsoft.com/en-us/library/gg328332.aspx">https://msdn.microsoft.com/en-us/library/gg328332.aspx</a></p>
<p>For complete syntax and validation rule for FetchXML check below XSD<br />
<a href="https://msdn.microsoft.com/en-us/library/gg309405.aspx">https://msdn.microsoft.com/en-us/library/gg309405.aspx</a></p><pre class="crayon-plain-tag">&lt;fetch distinct='false' no-lock='false' mapping='logical'&gt;
  &lt;entity name='account'&gt;
    &lt;attribute name='name' /&gt;
    &lt;attribute name='accountid' /&gt;
    &lt;attribute name='accountid' rowaggregate='CountChildren' alias='AccountChildren'/&gt;
    &lt;filter type='and'&gt;
      &lt;condition attribute='accountid' operator='under' value='{0}' /&gt;
    &lt;/filter&gt;
  &lt;/entity&gt;
&lt;/fetch&gt;</pre><p>
<h3>Using DateTime Operators with the SSIS Dynamics CRM / Dataverse read task</h3>
<p>This example shows how to write FetchXML query to get all tickets which are created 30 mins before.</p>
<p>Other similar operators are<br />
olderthan-x-hours<br />
olderthan-x-days<br />
olderthan-x-weeks<br />
olderthan-x-months<br />
olderthan-x-years</p>
<p>For a list of supported DateTime operators<br />
<a href="https://msdn.microsoft.com/en-us/library/gg334216.aspx">https://msdn.microsoft.com/en-us/library/gg334216.aspx</a></p>
<p>For a list of all supported operators check below XSD and search for name=&#8221;operator&#8221;<br />
<a href="https://msdn.microsoft.com/en-us/library/gg309405.aspx">https://msdn.microsoft.com/en-us/library/gg309405.aspx</a></p>
<p>To build custom FetxhXML<br />
1. Login to your Dynamics CRM / Dataverse Portal<br />
2. Click on Advanced Find icon (Found next to the search textbox)<br />
3. Once done building query, Click on Download FetchXML icon. Copy that XML into Query editor of Dynamics CRM / Dataverse Source.</p>
<p>For more information about FetchXML query syntax check below links :<br />
<a href="https://msdn.microsoft.com/en-us/library/gg328117.aspx">https://msdn.microsoft.com/en-us/library/gg328117.aspx</a><br />
<a href="https://msdn.microsoft.com/en-us/library/gg328332.aspx">https://msdn.microsoft.com/en-us/library/gg328332.aspx</a></p>
<p>For complete syntax and validation rule for FetchXML check below XSD<br />
<a href="https://msdn.microsoft.com/en-us/library/gg309405.aspx">https://msdn.microsoft.com/en-us/library/gg309405.aspx</a></p><pre class="crayon-plain-tag">&lt;fetch&gt;
  &lt;entity name='incident'&gt;
    &lt;attribute name='title' /&gt;
    &lt;attribute name='ticketnumber' /&gt;
    &lt;attribute name='createdon' /&gt;
    &lt;attribute name='incidentid' /&gt;
    &lt;filter type='and'&gt;
      &lt;condition attribute='createdon' operator='olderthan-x-minutes' value='30' /&gt;
    &lt;/filter&gt;
  &lt;/entity&gt;
&lt;/fetch&gt;</pre><p>
<h3>Query &#8211; All activities (sort, outer join, alias) with the SSIS Dynamics CRM / Dataverse read task</h3>
<p>This example shows how to get all activities performed on lead or contact. It shows how to get attributes from lead and contact by using OUTER JOIN.</p>
<p>This FetchXML is the equivalent of below SQL</p><pre class="crayon-plain-tag">SELECT a.*
, l.firstname as lead_name,l.emailadddress1 as lead_email1
, c.firstname as contact_name
FROM activitypointer a
LEFT OUTER JONI lead l ON a.regardingobjectid=l.leadid
LEFT OUTER JONI lead c ON a.regardingobjectid=c.contactid
ORDER BY a.createdon DESC</pre><p>
To build custom FetxhXML<br />
1. Login to your Dynamics CRM / Dataverse Portal<br />
2. Click on Advanced Find icon (Found next to the search textbox)<br />
3. Once done building query, Click on Download FetchXML icon. Copy that XML into Query editor of Dynamics CRM / Dataverse Source.</p>
<p>For more information about FetchXML query syntax check below links :<br />
<a href="https://msdn.microsoft.com/en-us/library/gg328117.aspx">https://msdn.microsoft.com/en-us/library/gg328117.aspx</a><br />
<a href="https://msdn.microsoft.com/en-us/library/gg328332.aspx">https://msdn.microsoft.com/en-us/library/gg328332.aspx</a></p>
<p>For complete syntax and validation rule for FetchXML check below XSD<br />
<a href="https://msdn.microsoft.com/en-us/library/gg309405.aspx">https://msdn.microsoft.com/en-us/library/gg309405.aspx</a></p><pre class="crayon-plain-tag">&lt;fetch version='1.0' mapping='logical'&gt;
	&lt;entity name='activitypointer'&gt;
		&lt;attribute name='subject' /&gt;
		&lt;attribute name='ownerid' /&gt;
		&lt;attribute name='regardingobjectid' /&gt;
		&lt;attribute name='activitytypecode' /&gt;
		&lt;attribute name='scheduledstart' /&gt;
		&lt;attribute name='scheduledend' /&gt;
		&lt;attribute name='instancetypecode' /&gt;
		&lt;attribute name='community' /&gt;
		&lt;attribute name='actualend' /&gt;
		&lt;attribute name='createdon' /&gt;
		
		&lt;link-entity name='lead' from='leadid' to='regardingobjectid' link-type='outer' alias='l'&gt;
			&lt;attribute name='firstname' alias='lead_name' /&gt;
			&lt;attribute name='emailaddress1' alias='lead_email1' /&gt;
			&lt;attribute name='companyname' alias='lead_company' /&gt;
		&lt;/link-entity&gt;  
		
		&lt;link-entity name='contact' from='contactid' to='regardingobjectid' link-type='outer' alias='c'&gt;
			&lt;attribute name='firstname' alias='contact_name' /&gt;
		&lt;/link-entity&gt;  

		&lt;order attribute='createdon' descending='true' /&gt;
	&lt;/entity&gt;
&lt;/fetch&gt;</pre><p>
<h2>How to use SSIS variables with Fetch XML in SSIS for SSIS Dynamics</h2>
<h2>CRM read</h2>
<p>You can include variables in an XML fetch.</p>
<ol>
<li>
        First, create your variable in the SSDT. Go to SSIS and Variables and create your variable:</p>
<p>        <div id="attachment_3514" style="width: 762px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-variable-value.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3514" class="size-full wp-image-3514" src="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-variable-value.jpg" alt="ssis-variable-value" width="752" height="113" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-variable-value.jpg 752w, https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-variable-value-300x45.jpg 300w" sizes="(max-width: 752px) 100vw, 752px" /></a><p id="caption-attachment-3514" class="wp-caption-text">SSIS variable value</p></div>
    </li>
</ol>
<p>In addition, create your fetch, include the variable in the XM ({{User::value}}):</p><pre class="crayon-plain-tag">&lt;fetch mapping='logical' version='1.0'&gt;
  &lt;entity name='account'&gt;
    &lt;attribute name='name' /&gt;
    &lt;filter&gt;
      &lt;condition attribute='revenue' operator='eq' value='{{User::value}}' /&gt;
    &lt;/filter&gt;
  &lt;/entity&gt;
&lt;/fetch&gt;</pre><p>
<h2>Conclusion about the SSIS Dynamics CRM / Dataverse read task</h2>
<p>To conclude, we can say that the ZS Dynamic CRM source is a great tool to get data from Microsoft CRM Dynamics and export any other destination format. In this article, we learn how to create queries to CRM Dynamics using fetch data. We used several examples to query data. We also learned to use SSIS variables in our queries and how to export the data from Dynamics CRM / Dataverse to SQL Server. <a href="https://zappysys.com/products/ssis-powerpack/download/" target="_blank" rel="noopener">Download SSIS PowerPack</a> to explore Dynamics CRM / Dataverse integration possibilities in SSIS.</p>
<h2>References about SSIS Dynamics CRM / Dataverse read</h2>
<ul>
<li><a href="https://www.microsoft.com/en-us/dynamics365/what-is-crm">What is CRM?</a></li>
<li><a href="https://zappysys.com/products/ssis-powerpack/ssis-dynamics-crm-source-connector/">SSIS Dynamics CRM / Dataverse Source Connector (Dynamics 365 / On-Premises CRM)</a></li>
</ul>
<p>The post <a href="https://zappysys.com/blog/ssis-dynamics-crm-read-import-crm-365-onpremises/">SSIS Dynamics CRM / Dataverse &#8211; Read / Import data into SQL Server</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
