Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BulkDeleteRequest job is stuck in Waiting Status and manually resume it #119

Closed
anuxps opened this issue May 16, 2020 · 2 comments
Closed

Comments

@anuxps
Copy link

anuxps commented May 16, 2020

I have used the BulkDeleteRequest sample code and able to submit the job successfully. I am using Dynamics Online. But When the job is submitted it will remain stuck or hung state "Waiting" till I will go and select manually resume the job. After manually resume, it is deleting the records. There is no other jobs are running so ideally it should be executed immediately.

What is the reason that job stuck in a waiting state?

image

Here is the code:

var deleteCondition = new ConditionExpression(
                    EntityName,IdentityColumn, ConditionOperator.In, "123");

                    // Create a fiter expression for the bulk delete request.
                    var deleteFilter = new FilterExpression();
                    deleteFilter.Conditions.Add(deleteCondition);

                    // Create the bulk delete query set.
                    var bulkDeleteQuery = new QueryExpression
                    {
                        EntityName = EntityName,
                        Distinct = false,
                        Criteria = deleteFilter
                        //ColumnSet = new ColumnSet(true)
                    };

                    // Create the bulk delete request.
                    var bulkDeleteRequest = new BulkDeleteRequest
                    {
                        JobName = "One Guid " + EntityName,
                        QuerySet = new[] { bulkDeleteQuery },
                        StartDateTime = DateTime.Now,
                        ToRecipients = new[] { userid },
                        CCRecipients = new Guid[] { },
                        SendEmailNotification = false,
                        RecurrencePattern = String.Empty
                        
                    };
                    
                    // Submit the bulk delete job.
                    // NOTE: Because this is an asynchronous operation, the response will be
                    // immediate.
                    
                     var bulkDeleteResponse = (BulkDeleteResponse)organizationService.Execute(bulkDeleteRequest);
                   
                    _asyncOperationId = bulkDeleteResponse.JobId;
@Dynamics365guy
Copy link

@anuxps The Timeout is set to 2 mins by default, try to change the default time and try it. We don't find any issue when we run from our end. Sometimes system jobs takes longer time for various reasons.

@Nkrb
Copy link
Contributor

Nkrb commented May 26, 2020

Thanks for contacting us. As we haven’t heard back from you, I am closing this issue. If you need further help, please reopen the issue or open a new issue.

@Nkrb Nkrb closed this as completed May 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants