web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Send E-Mail workflow step: Cannot update parties unless email is in draft status

(0) ShareShare
ReportReport
Posted on by

Hi All,

I need some help, I have no more ideas what's going wrong.
Please help, I only need some more ideas !!

System: CRM 2011 UR10, OnPremise, E-Mail Router

We have some really simple workflows triggered by specific field changes on accounts, every workflow has one "Send email" activity step. Sometimes this step fails in different workflows with the message "Cannot update parties unless email is in draft status", detailed message see below.

We have the situation that the same user changes the same field in the same account. One day the workflows are running the next day they fail. And also very strange: if we enable CRM Server tracing the error does nearly never happen (1 time in 3 weeks), with disabled tracing we see this error about 5 times the day...

What we have already checked:

  • No other workflows on email, that change the status of the created email or do other things with emails
  • No plugins that are registered on emails/none...
  • No E-Mail Router eventlog warning/error entries
  • Not a security issue (Owner of workflow is sysadmin, User that triggers workflow is sysadmin, Sender, Owner of E-Mail is Sysadmin)
  • E-Mail Addresses are approved
  • Sender, Owner is not set in the "Send email" activity step, will be filled with the workflow owner...

Thx for your help

Markus

Workflow paused due to error: Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]:Cannot update parties unless email is in draft status.Detail:

<OrganizationServiceFault xmlns:i="www.w3.org/.../XMLSchema-instance" xmlns="schemas.microsoft.com/.../Contracts">

 <ErrorCode>-2147187962</ErrorCode>

 <ErrorDetails xmlns:d2p1="schemas.datacontract.org/.../System.Collections.Generic" />

 <Message>Cannot update parties unless email is in draft status.</Message>

 <Timestamp>2013-02-06T07:54:29.5128838Z</Timestamp>

 <InnerFault>

   <ErrorCode>-2147187962</ErrorCode>

   <ErrorDetails xmlns:d3p1="schemas.datacontract.org/.../System.Collections.Generic" />

   <Message>Cannot update parties unless email is in draft status.</Message>

   <Timestamp>2013-02-06T07:54:29.5128838Z</Timestamp>

   <InnerFault i:nil="true" />

   <TraceText i:nil="true" />

 </InnerFault>

 <TraceText i:nil="true" />

</OrganizationServiceFault>

  at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.Execute(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)

  at Microsoft.Crm.Extensibility.InprocessServiceProxy.ExecuteCore(OrganizationRequest request)

  at Microsoft.Crm.Workflow.Services.SendEmailActivityService.<>c__DisplayClass1.<SendEmailInternal>b__0(IOrganizationService sdkService)

  at Microsoft.Crm.Workflow.Services.ActivityServiceBase.ExecuteInTransactedContext(ActivityDelegate activityDelegate)

  at Microsoft.Crm.Workflow.Services.SendEmailActivityService.ExecuteInternal(ActivityContext executionContext, SendEmail sendEmail)

  at Microsoft.Crm.Workflow.Services.SendEmailActivityService.Execute(ActivityContext executionContext, SendEmail sendEmail)

  at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)

  at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

*This post is locked for comments

I have the same question (0)
  • Al Ericson Profile Picture
    240 on at

    Hi Markus,

    Thanks for posting your question.

    Sounds like there is a timing issue. That sometimes the email leaves the draft state prior to a dynamic field being updated in the email.

    You may want to consider placing a timeout step in order for everything to completely process before sending the email.

    Prior to the send email step in the workflow, insert a timeout step of a duration of one minute:

    1. Deactivate the workflow to edit, select the send email step in the workflow, and select the insert option

    2. Select to insert a step before the sending of the email step, select add step and select Wait Condition

    3. In the details of the wait condition, select the first drop down and choose Process under local values

    4. On the next drop down, select timeout, select equals, and in the form assistant section with the dynamic values select the drop down for Duration

    5. Place a 1 minute duration using the drop down under Minute, save and close the condition

    This will place a 1 minute pause in the workflow and may impact the behavior you are experiencing.

    Hope this helps,

    Al Ericson

  • Community Member Profile Picture
    on at

    It really depends on whether you're using a "Send Email" step or a "Create Record" step and creating the Email that way.

    If you use Create Record, the email will remain in Draft status until you use a Change Status step on the Email you created.

    I believe the Send Email step will automatically attempt to Send the email asynchronously, which won't wait for the rest of your steps to complete.

    Jonathan Tabaka

  • Markus Dorfer Profile Picture
    on at

    Hi Al & Jonathan,

    thanks for your feedback, your input was very helpfull.

    We have added a second cpu a few months ago.

    I have checked the workflow history, the troubles started with the second cpu.

    The server is too fast ;-)

    I will try to add a timeout step and/or split the steps in Create Record and Change Status.

    Could it be that the E-Mail Router is causing this issue (record locking or something like that). ?

    Markus

  • Markus Dorfer Profile Picture
    on at

    Hi,

    the split in a Create Record step and Change Status step did not work for us, because the emails will not be send by the E-Mail Router (we tried with status Pending Send and Send --> both did not work).

    We have now added a Wait Condition before the E-Mail Send Step, now we have to wait...

    Markus

  • Community Member Profile Picture
    on at

    Markus,

    Sorry for the late response, I did a quick search to find a solution to your problem.

    community.dynamics.com/.../83984.aspx

    This link offers some solutions to the Outlook plugin not sending emails that are in Pending Send status.

    Basically it could either be a configuration in Outlook itself, or a security permission for the user running the workflow.

    This may help you use the Create Record Step vs the waiting step.

    Let me know how it goes =)

    Jonathan Tabaka

  • Markus Dorfer Profile Picture
    on at

    Hi Jonathan,

    we do not use Outlook to send emails, we us E-Mail Router.

    Markus

  • Muhammad Adeel Javaid Profile Picture
    5,580 on at

    That sounds like exchange configuration. Everything with CRM looks fine to me. It is also by design that you cannot send or update emails that have been sent (or have been requested to be sent).

  • Markus Dorfer Profile Picture
    on at

    Hi,

    we do not use Exchange in this scenario.

    E-Mail Router is sending via external SMTP server...

    Markus

  • Suggested answer
    Community Member Profile Picture
    on at

    Markus,

    I don't know if this issue is still on your radar, but I ran into this same situation with a workflow I was creating recently.

    I followed all of the steps that I could, approving the primary email for the user that the email was from, verifying that the router was configured properly, verifying that the router was running, and verifying that the user's outgoing email was set to email router.

    I found that if I set the email after the Create Record step to Sending and added it to the user's Queue it might send the email, but this step wasn't available within the workflow steps.

    What I ended up doing, was creating a workflow activity that accepted the email message associated with the Create Email step as an argument, and simply ran a SendEmailRequest.

    I tested this on a hosted deployment of CRM 2011 UR 12 successfully.

    Hopefully you don't have any other difficulties that I did not run into =)

    I don't know how familiar you are with custom workflow activities, but there are plenty of articles online regarding creating a workflow activity and registering it using the CRM 2011 SDK PluginRegistrationTool, found in the bin directory once you extract the SDK.

    The shell (very limited error checking) of the workflow is as follows:

    Forgive me if this isn't formatted properly, I'm new to these forums and don't know if there's a proper [code] tag as it were.

    using System;

    using System.Activities;

    using Microsoft.Xrm.Sdk;

    using Microsoft.Xrm.Sdk.Workflow;

    using Microsoft.Crm.Sdk.Messages;

    public sealed class SendEmail : CodeActivity

    {

       [Input("Email")]

       [ReferenceTarget("email")]

       public InArgument<EntityReference> Email { get; set; }

       public CodeActivityContext ExecutionContext { get; set; }

       public IWorkflowContext Context { get; set; }

       private IOrganizationService service { get; set; }

       public IOrganizationService Service

       {

           get

           {

               return this.service;

           }

           set

           {

               if (value == null)

                   throw new ArgumentNullException("Service");

               this.service = value;

           }

       }

       protected override void Execute(CodeActivityContext executionContext)

       {

           IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();

           IOrganizationServiceFactory serviceFactory = executionContext.GetExtension<IOrganizationServiceFactory>();

           if (context != null)

           {

               Service = serviceFactory.CreateOrganizationService(context.UserId);

           }

           ExecutionContext = executionContext;

           SendEmail();

       }

       private void SendEmail()

       {

           try

           {

               SendEmailRequest sendEmail = new SendEmailRequest();

               sendEmail.EmailId = Email.Get<EntityReference>(ExecutionContext).Id;

               sendEmail.IssueSend = true;

               sendEmail.TrackingToken = " ";

               Service.Execute(sendEmail);

           }

           catch (InvalidWorkflowException ee)

           {

               throw ee;

           }

       }

    }

  • Markus Dorfer Profile Picture
    on at

    Hi Jonathan,

    thx for your input.

    Yes from a technical point of view this would be a "workaround" and we have already tested this custom workflow activity in combination with the "Create entity" activity step, it works.

    But in my opinion this is a bug and should be solved...

    Markus

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans