Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<!-- This goes in your data flow as the source -->
<CustomComponent Name="TF Dynamics 365 <#=table.Name#>" ComponentTypeName="PragmaticWorks.TaskFactory.DynamicsSource" Version="1" ContactInfo="Dynamics Source;Pragmatic Works, Inc; Task Factory (c) 2009 - 2016 Pragmatic Works, Inc; http://www.pragmaticworks.com;support@pragmaticworks.com" UsesDispositions="true">
<Annotations>
<Annotation AnnotationType="Description">Extract data from Microsoft Dynamics CRM.</Annotation>
</Annotations>
<DataflowOverrides>
<OutputPath OutputPathName="Dynamics Source Output">
<!-- Iterate through the columns (I'm passing in table and column from another file), ignoring any audit columns you may have added to your table. Set the Error Row Disposition and Truncation Row Disposition. -->
<# foreach (var column in table.Columns.Where(c => !c.Name.Equals("AuditETLLogID") && !c.Name.Equals("AuditInsertDate"))) { #>
<Column ErrorRowDisposition="NotUsed" TruncationRowDisposition="NotUsed" ColumnName="<#=column.Name#>" />
<# } #>
</Columns>
</OutputPath>
</DataflowOverrides>
<CustomProperties>
<CustomProperty Name="DebugMode" DataType="Boolean">false</CustomProperty>
<CustomProperty Name="FilterQuery" DataType="String"></CustomProperty>
<CustomProperty Name="BatchSize" DataType="Int32" Description="The maximum number of records to retrieve per round trip to the dynamics server">500</CustomProperty>
<CustomProperty Name="FetchMode" DataType="Int32" TypeConverter="PragmaticWorks.TaskFactory.Components.Sources.Dynamics.DynamicsSource+FetchModeEnum, PragmaticWorks.TaskFactory.Components130, Version=1.0.0.0, Culture=neutral, PublicKeyToken=47acf905d0337c39" Description="How will data be retrieved from the entity. Name or Xml Query?">0</CustomProperty>
<CustomProperty Name="Entity" DataType="String" SupportsExpression="true" Description="Name of the entity to retrieve data from"><#=table.Name#></CustomProperty>
<CustomProperty Name="QueryXML" DataType="String" SupportsExpression="true" Description="The XML Query">&lt;filter type="and"&gt;&lt;/filter&gt;</CustomProperty>
<CustomProperty Name="Get Changes" DataType="Boolean" SupportsExpression="true" Description="Get the changes for an entity">false</CustomProperty>
<CustomProperty Name="Changes Token Variable" DataType="String" SupportsExpression="true" Description="The variable that will contain the tracking changes token."></CustomProperty>
</CustomProperties>
<OutputPaths>
<OutputPath Name="Dynamics Source Output">
<OutputColumns>
<!-- Add your columns here -->
<# foreach (var column in table.Columns.Where(c => !c.Name.Equals("AuditETLLogID") && !c.Name.Equals("AuditInsertDate"))) { #>
<# if (column.DataType == System.Data.DbType.Int32) { #>
<OutputColumn
Name="<#=column.Name#>"
ExternalMetadataColumnName="<#=column.Name#>"
ErrorOrTruncationOperation="Conversion"
ErrorRowDisposition="FailComponent"
TruncationRowDisposition="FailComponent" />
<# } else if (column.DataType == System.Data.DbType.String) { #>
<OutputColumn
Name="<#=column.Name#>"
Length="<#=column.Length#>"
DataType="<#=column.DataType#>"
ExternalMetadataColumnName="<#=column.Name#>"
ErrorOrTruncationOperation="Conversion"
ErrorRowDisposition="FailComponent"
TruncationRowDisposition="FailComponent" />
<# } else if (column.DataType == System.Data.DbType.Guid) { #>
<OutputColumn
Name="<#=column.Name#>"
DataType="Guid"
ExternalMetadataColumnName="<#=column.Name#>"
ErrorOrTruncationOperation="Conversion"
ErrorRowDisposition="FailComponent"
TruncationRowDisposition="FailComponent" />
<# } else if (column.DataType == System.Data.DbType.Double) { #>
<OutputColumn
Name="<#=column.Name#>"
DataType="Double"
ExternalMetadataColumnName="<#=column.Name#>"
ErrorOrTruncationOperation="Conversion"
ErrorRowDisposition="FailComponent"
TruncationRowDisposition="FailComponent" />
<# } else if (column.DataType == System.Data.DbType.Currency) { #>
<OutputColumn
Name="<#=column.Name#>"
DataType="Currency"
ExternalMetadataColumnName="<#=column.Name#>"
ErrorOrTruncationOperation="Conversion"
ErrorRowDisposition="FailComponent"
TruncationRowDisposition="FailComponent" />
<# } else if (column.DataType == System.Data.DbType.Boolean) { #>
<OutputColumn
Name="<#=column.Name#>"
DataType="Boolean"
ExternalMetadataColumnName="<#=column.Name#>"
ErrorOrTruncationOperation="Conversion"
ErrorRowDisposition="FailComponent"
TruncationRowDisposition="FailComponent" />
<# } else if (column.DataType == System.Data.DbType.DateTime) { #>
<OutputColumn
Name="<#=column.Name#>"
DataType="DateTime"
ExternalMetadataColumnName="<#=column.Name#>"
ErrorOrTruncationOperation="Conversion"
ErrorRowDisposition="FailComponent"
TruncationRowDisposition="FailComponent" />
<# } } #>
</OutputColumns>
<ExternalColumns>
<!-- Add your columns here -->
<# foreach (var column in table.Columns.Where(c => !c.Name.Equals("AuditETLLogID") && !c.Name.Equals("AuditInsertDate"))) { #>
<# if (column.DataType == System.Data.DbType.Int32) { #>
<ExternalColumn
Name="<#=column.Name#>" />
<# } else if (column.DataType == System.Data.DbType.String) { #>
<ExternalColumn
Name="<#=column.Name#>"
Length="<#=column.Length#>"
DataType="String" />
<# } else if (column.DataType == System.Data.DbType.Guid) { #>
<ExternalColumn
Name="<#=column.Name#>"
DataType="Guid" />
<# } else if (column.DataType == System.Data.DbType.Double) { #>
<ExternalColumn
Name="<#=column.Name#>"
DataType="Double" />
<# } else if (column.DataType == System.Data.DbType.Currency) { #>
<ExternalColumn
Name="<#=column.Name#>"
DataType="Currency" />
<# } else if (column.DataType == System.Data.DbType.Boolean) { #>
<ExternalColumn
Name="<#=column.Name#>"
DataType="Boolean" />
<# } else if (column.DataType == System.Data.DbType.DateTime) { #>
<ExternalColumn
Name="<#=column.Name#>"
DataType="DateTime" />
<# } } #>
</ExternalColumns>
</OutputPath>
</OutputPaths>
<Connections>
<!-- Do not change Name of DYNAMICSCONNECTION -->
<Connection Name="DYNAMICSCONNECTION" ConnectionName="TF_DynamicsCRM" />
</Connections>
</CustomComponent>
<!-- This goes in your environments file or elsewhere, just including to keep this with the source component -->
<CustomSsisConnection Name="TF_DynamicsCRM" CreateInProject="true" CreationName="DynamicsCrmConnectionManager" ObjectData="&lt;DynamicsConnectionManager
ConnectionString=&quot;UseProxy=False;UseConnectionSharing=False;ServerType=3;CRMVersion=4;OrganizationName=MyOrgName;ProxyHost=;ProxyPort=0;ProxyUser=;ReuseSameConnection=False;ServerHost=disco.crm.dynamics.com;ServerTimeout=60;ServerUser=Myuser@domain.com;&quot;&gt;
&lt;ServerPassword
Sensitive=&quot;1&quot; xmlns=&quot;www.microsoft.com/SqlServer/Dts&quot;
p4:Salt=&quot;mOECnMOaUg==&quot;
p4:IV=&quot;Y91tUjUbZZk=&quot;
xmlns:p4=&quot;www.microsoft.com/SqlServer/SSIS&quot;&gt;DxApS7rkG1qIrWFNXW7lVxhP1NCf5ERQLLuBUoIgh+0Qq2h3j8EltnVddZLUKDcYTisgAp5dUICR827d5VaHqsn2Q2SbWB2Q2XVL5pzd38/E4j+vds1beozDzD10OLdXxql11vCvEE0=&lt;/ServerPassword&gt;
&lt;/DynamicsConnectionManager&gt;"/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.