Mapping to CRM 2011 entity Retrive node ColumnSet fields.


  • In map given in below link,

    I would like to map 'id' to any of CRM entity  field lets say 'managername'(text field).  If found then I would like to do further processing. How would I do that?


    Pabitra Dash


    • Edited by Pabitra Dash Saturday, September 7, 2013 7:42 AM
    Saturday, September 7, 2013 7:34 AM


All replies

  • in addition to my responses to your other post, this arcticle from Richard Seroter @ and a followup article @ are excellent guides when using maps in BizTalk for CRM Integration.


    • Edited by Shankycheil Saturday, September 7, 2013 9:20 AM followup reference
    Saturday, September 7, 2013 9:13 AM
  • I use the following map in which 'id' is mapped to Scripting functoid with Inline XSLT, which has following script.

    <string xmlns="

    I got following error when I did Test map in visual stuio.

    Output validation error: The element 'Columns' in namespace '' has invalid child element 'string' in namespace '
    Serialization/Arrays'. List of possible elements expected: 'string' in namespace ''.

    What could be the problem?


    Saturday, September 7, 2013 9:51 AM
  • Your final output from the map should resemble something like

    <ns0:Retrieve xmlns:ns0="">
        <ns1:AllColumns xmlns:ns1="">false</ns1:AllColumns>
        <ns1:Columns xmlns:ns1="">
          <ns2:string xmlns:ns2="">managername</ns2:string>

    You could be getting this error because there is no value assigned to the "entityname" and also ensure that the ID is actually the GUID of the employee record in CRM.


    PS: I use a regular program with the CRM SDK to first try out the calls with CRM before trying to convert them into the XML message for calls through BizTalk.

    Saturday, September 7, 2013 10:04 AM
  • I get following output. "entityname" is assigned to value 'contact' through value map functoid. Still no idea why valaidation error is coming. But is this map correct? If I pass valid 'managername', would I get contact object from CRM? 'managername' would be unique.

    Yes data type of ID is 'guid (SimpleType)'.

    <ns0:Retrieve xmlns:ns0=""          xmlns:ns2="" xmlns:ns3="" xmlns:ns5="" xmlns:ns1="" xmlns:ns4="">
          <string xmlns=" Serialization/Arrays">managername</string>

    Please help.


    • Edited by Pabitra Dash Saturday, September 7, 2013 10:29 AM
    Saturday, September 7, 2013 10:29 AM
  • The <ns0:id>GUID</ns0:id> is also a mandatory field. This GUID is the contact GUID. Then in the columnSet you indicate the columns defined for the entity that you want retrieved.

    So if you see the difference between what I posted and wht your map  generates, the is is missing. So when you type in the GUID associated with the contact, you'd in the result get the managername field.


    Saturday, September 7, 2013 10:43 AM
  • But in my case I would like to retrieve the contact id based on 'managername' (In future I would like to add a unique custom field of type 'string', based on this unique field contact id would be retrived). Is this not possible?


    Saturday, September 7, 2013 10:54 AM
  • In that case you need to call "RetrieveMultiple" using the FetchXML method I explained.... Retrieve requires the GUID and is used for getting specified attributes on the entity is you know the GUID.


    Saturday, September 7, 2013 11:12 AM
  • Hi Shankycheil,

    Do you have any sample for RetrieveMultiple and RetrieveMultipleRespones?

    Which WCF adapter I need to use? WCF_BasicHttp or WCF_Custom? Where to set credential for send port?

    I need to retrieve contact ID. Is the following 'Online XSLT' in script funtoid code (in following map ) sufficient to retrieve it?


    Monday, September 9, 2013 10:07 AM
  • I am getting following error while connecting to CRM 2011. I am using WCF Basic-Http send port. WHat could be the problem? Please help.

    Details:"System.Net.WebException: Content Type text/xml; charset=utf-8 was not supported by service


    Monday, September 9, 2013 3:31 PM
  • Hi Pabitra,

    The error says the text encoding which you have used "utf-8" is not supported .

    You need to find what encoding is supported by the service, you can try to change "utf-8" (8 bit)--> "utf-16(16 bit)"

    I hope this helps!!!!!!

    Maheshkumar S. Tiwari|BizTalk Developer Interview Questions and Answers

    Monday, September 9, 2013 3:39 PM
  • Hi Mahesh,

    Thank you for your response. How to find encoding supported by service? The service is running in MS Dynamic CRM 2011 with WCF end point.


    Monday, September 9, 2013 5:11 PM
  • Are you using the bindings generated when using the "Consume MEX Endpoint" wizard?


    Tuesday, September 10, 2013 4:58 AM
  • Corrected. Thanks.

    But getting following exception.

    The adapter failed to transmit message going to send port "CRM : Get contact status" with URL "http://vmcrm6:5555/Barcodes/xrmservices/2011/Organization.svc". It will be retransmitted after the retry interval specified for this Send Port. Details:"System.ServiceModel.Security.MessageSecurityException: An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail. ---> System.ServiceModel.FaultException: The message could not be processed because the action '<BtsActionMapping xmlns:xsi="" xmlns:xsd="">
      <Operation Name="Create" Action="" />
      <Operation Name="Retrieve" Action="" />
      <Operation Name="Update" Action="" />
      <Operation Name="Delete" Action="" />
      <Operation Name="Execute" Action="" />
      <Operation Name="Associate" Action="" />
      <Operation Name="Disassociate" Action="" />
      <...' is invalid or unrecognized.
       --- End of inner exception stack trace ---

    Server stack trace:
       at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.EndRequest(IAsyncResult result)

    Exception rethrown at [0]:
       at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
       at System.ServiceModel.Channels.IRequestChannel.EndRequest(IAsyncResult result)
       at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.RequestCallback(IAsyncResult result)".


    Tuesday, September 10, 2013 7:51 AM
  • Hi Shankycheil,

    Any idea on above exception? Please help.




    Tuesday, September 10, 2013 9:00 AM
  • On the bindings generated, you need to ensure that you're not using the proxy and the security credentials are set to NTLM. Also ensure that the BizTalk Host Instance account is a "System Administrator" in CRM.

    Secondly, it seems that the port type and message types in the orchestration are not properly set as the Action property is not getting set on your call to CRM so there might be a confusion w.r.t the action to be taken.

    So when you generated the service bindings there is an "odx" created with the message types, port types. Check with the properties on that with what you've set in your orchestration.


    Tuesday, September 10, 2013 9:15 AM
  • Hi Shankycheil,

    I am not using proxy and the security credentials are set to NTLM. Also Biztalk Host Instance account is 'System Administrator' in CRM.

    I am not using binding generated from "Consume MEX Endpoint" wizard as I am not allowed use third party message types in Orchestration. I am using these message types in outbound and inbound mappers of bi-directional send ports. Should I use 'wsdl and XSD' instead of MEX end points? Please help.


    Tuesday, September 10, 2013 10:17 AM
  • I really did not understand your statement "I am not using binding generated from "Consume MEX Endpoint" wizard as I am not allowed use third party message types in Orchestration. I am using these message types in outbound and inbound mappers of bi-directional send ports."

    In your T & D do you have a test instance of CRM? You should ideally be generating the bindings and schemas against the actual CRM instance. This creates the sample orchestration with all the correct port types, message types.

    You should then use this generated orchestration to copy the correct message types and port types into your orchestration. This sets the correct "action type" from the orchestration and after you've bound it to the CRM WCF-Custom port during deployment, the orchestration is able to invoke the correct method. This is part of the PortData in the binding file.

    <?xml version="1.0" encoding="utf-8"?>
    <BindingInfo xmlns:xsi="" xmlns:xsd="" Assembly="Microsoft.BizTalk.Adapter.Wcf.Consuming, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Version="">
        <SendPort Name="WcfSendPort_OrganizationService_CustomBinding_IOrganizationService_Custom" IsStatic="true" IsTwoWay="true" BindingOption="0">
          <Description>service "OrganizationService" port "CustomBinding_IOrganizationService"</Description>
          <TransmitPipeline Name="Microsoft.BizTalk.DefaultPipelines.PassThruTransmit" FullyQualifiedName="Microsoft.BizTalk.DefaultPipelines.PassThruTransmit, Microsoft.BizTalk.DefaultPipelines, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Type="2" />
            <TransportType Name="WCF-Custom" Capabilities="907" ConfigurationClsid="af081f69-38ca-4d5b-87df-f0344b12557a" />
      &lt;BindingType vt="8"&gt;customBinding&lt;/BindingType&gt;
      &lt;BindingConfiguration vt="8"&gt;&amp;lt;binding name="CustomBinding_IOrganizationService"&amp;gt;&amp;lt;!--    WsdlImporter encountered unrecognized policy assertions in ServiceDescription '':    --&amp;gt;&amp;lt;!--    &amp;lt;wsdl:binding name='CustomBinding_IOrganizationService'&amp;gt;    --&amp;gt;&amp;lt;!--        &amp;lt;ms-xrm:AuthenticationPolicy xmlns:ms-xrm=""&amp;gt;..&amp;lt;/ms-xrm:AuthenticationPolicy&amp;gt;    --&amp;gt;&amp;lt;security defaultAlgorithmSuite="Default" authenticationMode="SspiNegotiated" requireDerivedKeys="true" securityHeaderLayout="Strict" includeTimestamp="true" keyEntropyMode="CombinedEntropy" messageProtectionOrder="SignBeforeEncryptAndEncryptSignature" messageSecurityVersion="WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10" requireSecurityContextCancellation="true" requireSignatureConfirmation="false"&amp;gt;&amp;lt;localClientSettings cacheCookies="true" detectReplays="true" replayCacheSize="900000" maxClockSkew="00:05:00" maxCookieCachingTime="Infinite" replayWindow="00:05:00" sessionKeyRenewalInterval="10:00:00" sessionKeyRolloverInterval="00:05:00" reconnectTransportOnFailure="true" timestampValidityDuration="00:05:00" cookieRenewalThresholdPercentage="60" /&amp;gt;&amp;lt;localServiceSettings detectReplays="true" issuedCookieLifetime="10:00:00" maxStatefulNegotiations="128" replayCacheSize="900000" maxClockSkew="00:05:00" negotiationTimeout="00:01:00" replayWindow="00:05:00" inactivityTimeout="00:02:00" sessionKeyRenewalInterval="15:00:00" sessionKeyRolloverInterval="00:05:00" reconnectTransportOnFailure="true" maxPendingSessions="128" maxCachedCookies="1000" timestampValidityDuration="00:05:00" /&amp;gt;&amp;lt;secureConversationBootstrap /&amp;gt;&amp;lt;/security&amp;gt;&amp;lt;textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16" messageVersion="Default" writeEncoding="utf-8"&amp;gt;&amp;lt;readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /&amp;gt;&amp;lt;/textMessageEncoding&amp;gt;&amp;lt;httpTransport manualAddressing="false" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Anonymous" bypassProxyOnLocal="false" decompressionEnabled="true" hostNameComparisonMode="StrongWildcard" keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous" realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false" useDefaultWebProxy="true" /&amp;gt;&amp;lt;/binding&amp;gt;&lt;/BindingConfiguration&gt;
      &lt;StaticAction vt="8"&gt;&amp;lt;BtsActionMapping xmlns:xsi="" xmlns:xsd=""&amp;gt;
      &amp;lt;Operation Name="Create" Action="" /&amp;gt;
      &amp;lt;Operation Name="Retrieve" Action="" /&amp;gt;
      &amp;lt;Operation Name="Update" Action="" /&amp;gt;
      &amp;lt;Operation Name="Delete" Action="" /&amp;gt;
      &amp;lt;Operation Name="Execute" Action="" /&amp;gt;
      &amp;lt;Operation Name="Associate" Action="" /&amp;gt;
      &amp;lt;Operation Name="Disassociate" Action="" /&amp;gt;
      &amp;lt;Operation Name="RetrieveMultiple" Action="" /&amp;gt;
      &lt;UseSSO vt="11"&gt;0&lt;/UseSSO&gt;
      &lt;InboundBodyLocation vt="8"&gt;UseBodyElement&lt;/InboundBodyLocation&gt;
      &lt;InboundNodeEncoding vt="8"&gt;Xml&lt;/InboundNodeEncoding&gt;
      &lt;OutboundBodyLocation vt="8"&gt;UseBodyElement&lt;/OutboundBodyLocation&gt;
      &lt;OutboundXmlTemplate vt="8"&gt;&amp;lt;bts-msg-body xmlns="" encoding="xml"/&amp;gt;&lt;/OutboundXmlTemplate&gt;
      &lt;PropagateFaultMessage vt="11"&gt;-1&lt;/PropagateFaultMessage&gt;
      &lt;EnableTransaction vt="11"&gt;0&lt;/EnableTransaction&gt;
      &lt;IsolationLevel vt="8"&gt;Serializable&lt;/IsolationLevel&gt;
      &lt;Identity vt="8"&gt;&amp;lt;identity&amp;gt;
      &amp;lt;userPrincipalName value="CRMAPPPOOLACCOUNT" /&amp;gt;
            <SendHandler xsi:nil="true" />
          <ReceivePipeline Name="Microsoft.BizTalk.DefaultPipelines.XMLReceive" FullyQualifiedName="Microsoft.BizTalk.DefaultPipelines.XMLReceive, Microsoft.BizTalk.DefaultPipelines, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Type="1" />
          <ReceivePipelineData xsi:nil="true" />
          <Filter />
          <ApplicationName xsi:nil="true" />

    I've included a sample binding file generated and if you notice the Actions (Operation Name) portions would not get set. You could ask your administrators to generate the WSDL from the CRM Host and then use that to generate the correct bindings, port types and message types. You would then replace the generated schemas with the ones from the CRM SDK.


    Tuesday, September 10, 2013 10:50 AM
  • Hi Shankycheil,

    Thank you for your response. I generated the following WSDL from CRM Host. Please let me how to generate correct bindings, port types and message types from this. Please help.

    <?xml version="1.0" encoding="utf-8"?>
    <wsdl:definitions name="OrganizationService" targetNamespace="" xmlns:wsdl="" xmlns:wsx="" xmlns:wsa10="" xmlns:tns="" xmlns:soap12="" xmlns:wsu="" xmlns:wsp="" xmlns:wsap="" xmlns:msc="" xmlns:wsa="" xmlns:wsam="" xmlns:wsaw="" xmlns:soap="" xmlns:i0="" xmlns:xsd="" xmlns:soapenc=""><wsdl:import namespace="" location="http://vmcrm6:5555/Barcodes/xrmservices/2011/Organization.svc?wsdl=wsdl0"/><wsdl:types/>
    <wsdl:service name="OrganizationService"><wsdl:port name="CustomBinding_IOrganizationService" binding="i0:CustomBinding_IOrganizationService"><soap12:address location="http://vmcrm6:5555/Barcodes/xrmservices/2011/Organization.svc/>
    <Identity xmlns=""><Spn>host/</Spn></Identity>


    Tuesday, September 10, 2013 12:29 PM
  • In your T & D create a BizTalk Project (e.g. MyExperimentsWithCRM) and then

    1. Right click on the Project
    2. Select Add - Add Generated Items
    3. In the Wizard, select "Consume WCF Service"
    4. If you can ping the CRM Server (vmcrm6:5555) then in the WCF Wizard select "Metadata Exchange" and type in the URL there which in your case would be


    1. Then give the namespace "e.g. MyExperimentsWithCRM.CRMSOAP"
    2. Then it will proceed to generate the bindings file, schemas and the empty orchestration.

    This would be the best option. If you want to generate based on a file then I suggest you generate the WSDL file from the following location


    This will give you the complete file. Save this file as CRMServices.WSDL and in the step 4 above select the other option (Metadata WSDL and XSD), add the above file and then have it generate the rest of the stuff for you.


    Tuesday, September 10, 2013 1:09 PM
  • I forgot to add that once the schemas have been generated, the project will not compile because of certain namespace issues with the schemas. You should download the CRM 2011 SDK from and when you install it, you will find the correct schemas in the SDK. In the generated project you would need to replace the schemas generated with the SDK schemas and then the project would build.


    Tuesday, September 10, 2013 1:41 PM
  • Hi Shankycheil,

    I already tried first option you suggested with 'Metadata Exchange'. Current it is implemented MEX end point only. But still no luck.



    Tuesday, September 10, 2013 2:24 PM
  • In the Web Service wizard did you give the URL as


    and did it resolve properly?

    Or from your IE browser can you browse to the above URL and save the source as CRMServices.wsdl and then use the second option in the Consume WCF Service wizard?

    It is not luck :D what is the error/results you got?


    Tuesday, September 10, 2013 2:54 PM
  • In web service wizard I give the following link as you suggested in your earlier thread.



    Tuesday, September 10, 2013 3:09 PM
  • You should use the http://vmcrm6:5555/Barcodes/xrmservices/2011/Organization.svc?wsdl=wsdl0 URL to generate the biztalk artefacts.

    If you're still facing a problem give me your e-mail id and I'll see if I can send a BTS Project across...


    • Marked as answer by Pabitra Dash Wednesday, September 11, 2013 7:47 AM
    Wednesday, September 11, 2013 6:54 AM