BulkDeleteRequest returns error 'Server was unable to process request.'

Unanswered BulkDeleteRequest returns error 'Server was unable to process request.'

  • Monday, 26 October 2009 8:12 AM
     
      Has Code
    Hi.

    I have the BulkDeleteRequest that you see below. It's more or less taken directly from the SDK sample. On one server it runs with no errors but on another server I get the error message 'Server was unable to process request.'. Any sugestions on what I have to do? Any special process that need to run on the server for this to work?

    private void DeleteAllMifRecords()
            {
                QueryExpression query = new QueryExpression();
                query.EntityName = "xrm_xeroxmachinesinfield";
    
                // Create the bulk delete request
                BulkDeleteRequest bulkDeleteRequest = new BulkDeleteRequest();
    
                // Set the request properties
                bulkDeleteRequest.JobName = "Xerox MIF Bulk Delete";
                bulkDeleteRequest.QuerySet = new QueryBase[] { query };
    
                // Set the start time for the bulk delete
                bulkDeleteRequest.StartDateTime = new CrmDateTime();
                bulkDeleteRequest.StartDateTime.Value = DateTime.Now.ToString();
    
                // Set the required recurrence pattern
                bulkDeleteRequest.RecurrencePattern = string.Empty;
    
                // Set email activity properties
                bulkDeleteRequest.SendEmailNotification = false;
                bulkDeleteRequest.ToRecipients = new Guid[] { };
                bulkDeleteRequest.CCRecipients = new Guid[] { };
    
                // Submit the bulk delete job.
                // NOTE: Because this is an asynchronous operation, the response will be immediate.
                service.Execute(bulkDeleteRequest);
            }

All Replies

  • Monday, 26 October 2009 8:29 AM
     
     
    Hi,

    I assume the entity xrm_xeroxmachinesinfield exists on the server on which the code is failing.
    Surround the service.Execute call with a try/catch block and catch the SoapException. Its Detail property will tell you more about the issue.
  • Monday, 26 October 2009 8:40 AM
    Moderator
     
      Has Code
    It seems that you have error on line

    bulkDeleteRequest.StartDateTime = new CrmDateTime();
    bulkDeleteRequest.StartDateTime.Value = DateTime.Now.ToString();

    you should use following code:

    bulkDeleteRequest.StartDateTime = CrmDateTime.Now;

    Truth is opened the prepared mind My blog - http://a33ik.blogspot.com
  • Monday, 26 October 2009 8:51 AM
     
     
    Yes the entity xrm_xeroxmachinesinfield exists on the server and the name is spelled right. Changed my try catch from Exception to SoapException and that tells me I have NullReferenceException:

     System.NullReferenceException: Object reference not set to an instance of an object.

    I just can't see where in my code that is.


    Changing the code to bulkDeleteRequest.StartDateTime = CrmDateTime.Now; won't help with this problem but it's 1 line of code less so why not :-)

  • Monday, 26 October 2009 8:56 AM
    Moderator
     
      Has Code
    Hi.

    Try to add following line

     query.ColumnSet = new AllColumns();
    after line

     query.EntityName = "xrm_xeroxmachinesinfield";

    Result Code:

    QueryExpression query = new QueryExpression();
    query.EntityName = "xrm_xeroxmachinesinfield";
    query.EntityName = "xrm_xeroxmachinesinfield";


    Truth is opened the prepared mind My blog - http://a33ik.blogspot.com
  • Monday, 26 October 2009 9:29 AM
     
     

    there is another error message in the trace file saying:

    System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> Microsoft.Crm.CrmException: The date-time format for 26-10-2009 10:12:17 is invalid, or value is outside the supported range.

    I'm not sure if it's related to this problem or not.


    Another line in the trace file says:

    >MessageProcessor fail to process message 'BulkDelete' for 'none'.

    I'm not sure what to make of this.


    Andriy << I can't see how adding the Columnset to the query will do anything as it's not in the sample code and I know that my code runs fine on one server but not another.

  • Monday, 26 October 2009 10:31 AM
    Moderator
     
     
    Hi, Christian.

    Check this url . This is the code from SDK.

    Truth is opened the prepared mind My blog - http://a33ik.blogspot.com
  • Monday, 26 October 2009 10:46 AM
     
     
    My code is more or less like the sample in the SDK.

    After restarting the Async. process on the server I'm not getting any error messages but the Bulk Delete Job is still not created. I'm going crazy on this error :-)
  • Monday, 26 October 2009 1:21 PM
    Moderator
     
      Has Code
    Hi.

    This is strange...

    Following code works fine:

            static void Main(string[] args)
            {
    			CrmService crmservice = GetCrmService(<Your organization name>);
    
    			QueryExpression query = new QueryExpression();
    			query.EntityName = "contact";
    			query.ColumnSet = new AllColumns();
    
    			BulkDeleteRequest bulkDeleteRequest = new BulkDeleteRequest();
    
    			bulkDeleteRequest.JobName = "test";
    			bulkDeleteRequest.QuerySet = new QueryBase[] { query };
    
    			bulkDeleteRequest.StartDateTime = CrmDateTime.Now;
    
    			bulkDeleteRequest.RecurrencePattern = string.Empty;
    
    			bulkDeleteRequest.SendEmailNotification = false;
    			bulkDeleteRequest.ToRecipients = new Guid[] { };
    			bulkDeleteRequest.CCRecipients = new Guid[] { };
    
    			try
    			{
    				crmservice.Execute(bulkDeleteRequest);
    			}
    			catch (SoapException sexc)
    			{
    				throw new Exception(sexc.Detail.InnerText);
    			}
            }
    
            private static CrmService GetCrmService(string OrgName)
            {
                CrmAuthenticationToken token = new CrmAuthenticationToken();
                token.AuthenticationType = AuthenticationType.AD;
                token.OrganizationName = OrgName;
    
                CrmService crmService = new CrmService();
                crmService.UseDefaultCredentials = true;
                crmService.Url = (string)(Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\MSCRM").GetValue("ServerUrl")) + "/2007/crmservice.asmx";
                crmService.CrmAuthenticationTokenValue = token;
    
                return crmService;
            }
    

    Truth is opened the prepared mind My blog - http://a33ik.blogspot.com
  • Friday, 8 June 2012 9:15 AM
     
     

    Hi,

    If you look Remarks section on this link : http://msdn.microsoft.com/en-us/library/microsoft.crm.sdk.messages.bulkdeleterequest.aspx you will see that there is a list of supported entities.

    That means that not all entities are supported. And seemingly, custom entities are not supported also.

    I know that it's a bad news. but there is a limit for everything. and this is one of BulkDeleteRequest limits.

    I had the same problem with a custom entity but I haven't solution yet.

    If anyone has an idea. I will be glad to share it.