Answered by:
CRM 2011 Bulk Create Error

Question
-
Hi,
I tried creating multiple records at a time but got error. I am using sdk sample but it doesn't work perfectly. Below is the error detail.--
The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://schemas.microsoft.com/xrm/2011/Contracts/Services:request. The InnerException message was 'Error in line 1 position 11790. Element 'http://schemas.microsoft.com/xrm/2011/Contracts/Services:request' contains data from a type that maps to the name 'http://schemas.microsoft.com/xrm/2011/Contracts:ExecuteMultipleRequest'. The deserializer has no knowledge of any type that maps to this name. Consider changing the implementation of the ResolveName method on your DataContractResolver to return a non-null value for name 'ExecuteMultipleRequest' and namespace 'http://schemas.microsoft.com/xrm/2011/Contracts'.'. Please see InnerException for more details.
Any help will be appreciated.
Thanks,
Abhishek
Abhishek
Thursday, December 11, 2014 9:57 AM
Answers
-
Hi , i am using Microsoft CRM SDK Code as below. Create works fine it's give problem in bulk create
public class ExecuteMultiple { #region Class Level Members private OrganizationServiceProxy _serviceProxy; private readonly List<Guid> _newAccountIds = new List<Guid>(); ExecuteMultipleRequest requestWithResults; #endregion #region How To Sample Code /// <summary> /// This sample demonstrates how to execute a collection of message requests using a single web service /// call and optionally return the results. /// </summary> /// <seealso cref="http://msdn.microsoft.com/en-us/library/gg328075.aspx"/> /// <param name="serverConfig">Contains server connection information.</param> /// <param name="promptforDelete">When True, the user will be prompted to delete all /// created entities.</param> public void Run(ServerConnection.Configuration serverConfig, bool promptforDelete) { try { //<snippetExecuteMultiple1> // Get a reference to the organization service. using (_serviceProxy = ServerConnection.GetOrganizationProxy(serverConfig)) { // Enable early-bound type support to add/update entity records required for this sample. _serviceProxy.EnableProxyTypes(); #region Execute Multiple with Results // Create an ExecuteMultipleRequest object. requestWithResults = new ExecuteMultipleRequest() { // Assign settings that define execution behavior: continue on error, return responses. Settings = new ExecuteMultipleSettings() { ContinueOnError = false, ReturnResponses = true }, // Create an empty organization request collection. Requests = new OrganizationRequestCollection() }; // Create several (local, in memory) entities in a collection. EntityCollection input = GetCollectionOfEntitiesToCreate(); // Add a CreateRequest for each entity to the request collection. foreach (var entity in input.Entities) { CreateRequest createRequest = new CreateRequest { Target = entity }; requestWithResults.Requests.Add(createRequest); }
Thanks,
Abhishek
Abhishek
- Marked as answer by Abhisinha17 Monday, January 5, 2015 5:29 AM
Friday, December 12, 2014 2:20 AM
All replies
-
Hi,
Did you try by enabling proxy type? Did you try simple request like create?
((OrganizationServiceProxy)service).EnableProxyTypes();
If it doesn't help post your code.
Thanks!
Kalim Khan
Thursday, December 11, 2014 10:24 AM -
Hi , i am using Microsoft CRM SDK Code as below. Create works fine it's give problem in bulk create
public class ExecuteMultiple { #region Class Level Members private OrganizationServiceProxy _serviceProxy; private readonly List<Guid> _newAccountIds = new List<Guid>(); ExecuteMultipleRequest requestWithResults; #endregion #region How To Sample Code /// <summary> /// This sample demonstrates how to execute a collection of message requests using a single web service /// call and optionally return the results. /// </summary> /// <seealso cref="http://msdn.microsoft.com/en-us/library/gg328075.aspx"/> /// <param name="serverConfig">Contains server connection information.</param> /// <param name="promptforDelete">When True, the user will be prompted to delete all /// created entities.</param> public void Run(ServerConnection.Configuration serverConfig, bool promptforDelete) { try { //<snippetExecuteMultiple1> // Get a reference to the organization service. using (_serviceProxy = ServerConnection.GetOrganizationProxy(serverConfig)) { // Enable early-bound type support to add/update entity records required for this sample. _serviceProxy.EnableProxyTypes(); #region Execute Multiple with Results // Create an ExecuteMultipleRequest object. requestWithResults = new ExecuteMultipleRequest() { // Assign settings that define execution behavior: continue on error, return responses. Settings = new ExecuteMultipleSettings() { ContinueOnError = false, ReturnResponses = true }, // Create an empty organization request collection. Requests = new OrganizationRequestCollection() }; // Create several (local, in memory) entities in a collection. EntityCollection input = GetCollectionOfEntitiesToCreate(); // Add a CreateRequest for each entity to the request collection. foreach (var entity in input.Entities) { CreateRequest createRequest = new CreateRequest { Target = entity }; requestWithResults.Requests.Add(createRequest); }
Thanks,
Abhishek
Abhishek
- Marked as answer by Abhisinha17 Monday, January 5, 2015 5:29 AM
Friday, December 12, 2014 2:20 AM