Add DLL to GAC for Microsoft Dynamics CRM SSIS packages

I recently developed a SSIS package for Microsoft Dynamics CRM and after deploying it on the production SQL server I got this Error:

 Data Flow Task:Error: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Xrm.Sdk, Version=,
 Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
 File name: 'Microsoft.Xrm.Sdk, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
 at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.HandleUserException(Exception e)
 at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.PreExecute()
 at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostPreExecute(IDTSManagedComponentWrapper100 wrapper)

Since multiple CRM SDK  assemblies has been referenced in my SSIS project, the package execution failed with file not found error. In order to fix the issue,  those DLLs should be added to GAC in production server and here are the steps  to do it:

  1. My production environment is Windows server 2012, SQL server 2012, .net framework 4.0.
  2. In order to register DLLs I used Gacutil tool. The tool is part of Visual Studio tool set and in order to have it in production: Copy these two Gacutil files from dev environment
    • C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\gacutil.exe
    • C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\gacutil.exe.config
  3. Paste two files to “C:\Windows\Microsoft.NET\Framework\v4.0.30319” folder in production (.net 4.0):
  4. Run the command prompt as administrator and execute below command for each one of the CRM DLLs. for instance:
    • “C:\Windows\Microsoft.NET\Framework\v4.0.30319\gacutil.exe” /i “C:\Microsoft.Xrm.Sdk.dll”

now the package should run successfully on production server.


Working with Microsoft Dynamics CRM Party List

Party lists are system data types and there is no supported way to modify them.

Unsupported : In order to modify party lists you need to access them in the DOM by getting their id attribute.

for instance if you want to change the filter on the “from” party list in activities, use below code on form load:

//change the default filter to account entity and disable the others parties

function FilterFromPartyList() {
  document.getElementById("from_i").setAttribute("defaulttype", "1");
  // document.getElementById("from_i").setAttribute("defaulttype", "1,2"); //+contact
 document.getElementById("from_i").setAttribute("lookuptypes", "1");
 document.getElementById("from_i").setAttribute("lookuptypeIcons", "/_imgs/ico_1 6_1.gif");
 document.getElementById("from_i").disableViewPicker = 1;

Here is the list of the attributes that you can access through DOM:

<img width="20" height="18" title="Select a value." class="ms-crm-InlineLookupEdit" id="from_i" alt="Select a value." src="/_imgs/search_normal.gif" isDisplayOnly="false" ForceSubmit="false" isEnableInlineLookupForEditForms="1" lookupstyle="single" lookuptypes="1" lookuptypeIcons="/_imgs/ico_16_1.gif" lookuptypenames="account:1:Account,contact:2:Contact,lead:4:Lead,systemuser:8:User" data-fdeid="PrimaryEntity" resolveemailaddress="0" attrName="from" attrPriv="7" createpermissiondictionary="account:true,contact:true,lead:true,systemuser:true" crmattributeid="ca991199-24b8-4a1f-9bd9-55fddb6dcdcd" isDeDupLookup="0" defaulttype="1" autoresolve="1" showproperty="1" allowUnresolvedPartiesOnEmailSend="0" isInline="true" inlineViewIds="undefined" allowFilterOff="0" disableMru="1" disableQuickFind="0" disableViewPicker="0" DefaultViewId="{A3AF4AB8-861D-4CFA-92A5-E6281FED7FAB}" lookupbrowse="0" lookupDialogMultipleSelect="0">