Customer Engagement & Dynamics CRM Forum

Expand all | Collapse all

RealTime Workflow Error

  • 1.  RealTime Workflow Error

    SILVER CONTRIBUTOR
    Posted 14 days ago
    I created this real-time workflow on Friday.  It was working fine.  Monday morning, I am getting the error:

    The real-time workflow named "Work order Service cancel data changes" failed with the error "Cannot change data of a Closed Work Order"

    It is a very simple workflow:

    If Work Order (Work Order):Work Order Lock equals [Yes] then:
       Stop workflow with the status of: Canceled

    The properties of the Cancel I have the phrase:  Cannot change data of a Closed Work Order.

    The Comments from the Process Session states:

    Sync workflow failed with error message - Unhandled exception:
    Exception type: Microsoft.Xrm.Sdk.InvalidPluginExecutionException
    Message:

    -- End stack trace --

    Exception type: System.Activities.Statements.WorkflowTerminatedException
    Message: Cannot change data of a Closed Work Order
    at System.Activities.WorkflowApplication.Invoke(Activity activity, IDictionary`2 inputs, WorkflowInstanceExtensionManager extensions, TimeSpan timeout)
    at System.Activities.WorkflowInvoker.Invoke(Activity workflow, IDictionary`2 inputs, TimeSpan timeout, WorkflowInstanceExtensionManager extensions)
    at Microsoft.Crm.Workflow.SynchronousRuntime.SynchronousWorkflowActivityHost.ExecuteWorkflowUsingInvoker(Activity workflow, ICommonWorkflowContext context)
    at Microsoft.Crm.Workflow.SynchronousRuntime.SynchronousWorkflowActivityHost.StartWorkflow(WorkflowActivationData activationData, ICommonWorkflowContext context)
    -- End stack trace --

    , error code - -2147220970


    The Work Order Lock field is a custom field I added to the form.  So, I duplicated the workflow on the Work Order Parts entity using System Status of Closed-Posted.  Same results.  Same error.

    If I convert it to a Background workflow, it does not error, but it also does not prevent the data from changing.

    A few screen shots below:




    I DO see updates from Microsoft on Saturday night:


    Any ideas how I can track down what changed and how to recover?


    ------------------------------
    Paul Richards
    BlueCrest Inc
    Danbury
    ------------------------------
    The first step toward cloud success. - Migrate from CRM to D365 with expert guidance from Microsoft. I'm Ready


  • 2.  RE: RealTime Workflow Error

    TOP CONTRIBUTOR
    Posted 12 days ago
    Hi Paul,

    I'm not sure what version of Dynamics you are on, but have you looked into recreating this as a Business Rule instead of a workflow?  That would allow you to lock/unlock fields right at the load of the record's form based on the value in the Work Order Lock field.  It might be a better experience for your users as well.  They will realize up front that the fields are locked, instead of spending time making updates that get blocked by a workflow after the fact.

    ------------------------------
    Ben Edgren
    Solutions Architect - Business Intelligence
    Hufcor, Inc
    Janesville WI
    ------------------------------

    The first step toward cloud success. - Migrate from CRM to D365 with expert guidance from Microsoft. I'm Ready


  • 3.  RE: RealTime Workflow Error

    SILVER CONTRIBUTOR
    Posted 12 days ago
    Ben,

    Thank you for the reply.  I do use a Business Rule on the form where the Work Order lock field is located.  But, as the other forms do not have that lock field, the workflow is used to reference the related form.

    ------------------------------
    Paul Richards
    BlueCrest Inc
    Danbury
    ------------------------------

    The first step toward cloud success. - Migrate from CRM to D365 with expert guidance from Microsoft. I'm Ready


  • 4.  RE: RealTime Workflow Error

    TOP CONTRIBUTOR
    Posted 12 days ago
    Have you looked into or tried changing the "Scope" of the business rule from that specific form to "All Forms"?

    ------------------------------
    Ben Edgren
    Solutions Architect - Business Intelligence
    Hufcor, Inc
    Janesville WI
    ------------------------------

    The first step toward cloud success. - Migrate from CRM to D365 with expert guidance from Microsoft. I'm Ready


  • 5.  RE: RealTime Workflow Error

    SILVER CONTRIBUTOR
    Posted 11 days ago
    The scope of the business rule on that form is set to "All Forms".  There are 3 versions of that form and the BR works just fine on them.  The other forms are on a different entity and therefor cannot utilize a BR.  The workflow references the Related Entity.



    ------------------------------
    Paul Richards
    BlueCrest Inc
    Danbury
    ------------------------------

    The first step toward cloud success. - Migrate from CRM to D365 with expert guidance from Microsoft. I'm Ready


  • 6.  RE: RealTime Workflow Error

    TOP CONTRIBUTOR
    Posted 11 days ago
    Ah I see; I apologize I overlooked that before my earlier replies.  I'm guessing it has something to do with the status message.  Would it be possible to clear the text in the properties of the step and see if that allows it to work?  I don't know enough about those recent updates to say what would have caused it, so maybe someone else can jump in on that.

    ------------------------------
    Ben Edgren
    Solutions Architect - Business Intelligence
    Hufcor, Inc
    Janesville WI
    ------------------------------

    The first step toward cloud success. - Migrate from CRM to D365 with expert guidance from Microsoft. I'm Ready


  • 7.  RE: RealTime Workflow Error

    SILVER CONTRIBUTOR
    Posted 11 days ago
    If you mean in the properties of the "Stop workflow with status of: Canceled", I tried that as well.  I just got the same error but instead of saying "...with the error "Cannot change data of a Closed Work Order" it says: '....with the error "" '.

    ------------------------------
    Paul Richards
    BlueCrest Inc
    Danbury
    ------------------------------

    The first step toward cloud success. - Migrate from CRM to D365 with expert guidance from Microsoft. I'm Ready


  • 8.  RE: RealTime Workflow Error

    Posted 11 days ago
    Edited by Rob Pike 11 days ago
    ​Paul, since this is a real-time workflow it will only track the processes that failed. I would recommend checking the log and seeing if it is failing for everything that it is running on or if it is just one or two records that it is failing on. I am guessing that you will see that it is only failing on a particular record and possibly multiple times. From the view within the workflow you can see what record triggered the event. In your case it will be a work order service, once you open that record find the link to the work order that is related to the WO service, and I am sure you will find that it is Closed/Posted. I have never received that error message and had it not be true that the record wasn't in an editable state. If that is the case then that is the reason the workflow is failing. If that is true then there must be some loop-hole in the logic that is setting lock, and you should add logic to check that the related WO system status does not equal Closed/Posted or Cancelled. That should take care of the workflow failing.

    Hope this was helpful and good luck,
    Rob Pike

    ------------------------------
    Rob Pike
    RSM
    Minneapolis, MN
    ------------------------------

    The first step toward cloud success. - Migrate from CRM to D365 with expert guidance from Microsoft. I'm Ready


  • 9.  RE: RealTime Workflow Error

    SILVER CONTRIBUTOR
    Posted 11 days ago
    Rob,

    Thank you for the reply.  I can confirm that the referenced Work Order is Closed-Posted.  That is the point of the workflow: to prevent the changing of data on the related Service form.  I know that there is another one that triggers when a change tries to update the total amount.  But, that is the only time that WF protects the data.  We need the fields to also be protected when there is no charge for the service.

    ------------------------------
    Paul Richards
    BlueCrest Inc
    Danbury
    ------------------------------

    The first step toward cloud success. - Migrate from CRM to D365 with expert guidance from Microsoft. I'm Ready


  • 10.  RE: RealTime Workflow Error

    Posted 8 days ago
    Edited by Rob Pike 8 days ago
    ​Paul, putting the workflow error aside for a moment, could you provide the user story for what you are trying to accomplish with the workflow and/or possible the issue you are seeing with you data that is making this workflow necessary? It sounds like you are trying to prevent end users for updating work order service form but when is the prevention needed and is it to all fields on the form or just certain ones. Is this something that you are going to need to do in the mobile app as well or just the web app?

    Rob

    ------------------------------
    Rob Pike
    RSM
    Minneapolis, MN
    ------------------------------

    The first step toward cloud success. - Migrate from CRM to D365 with expert guidance from Microsoft. I'm Ready


  • 11.  RE: RealTime Workflow Error

    SILVER CONTRIBUTOR
    Posted 8 days ago
    Rob,

    You have it correct.  We need the data to not change on the Work Order Service form once the related Work Order has gone Closed-Posted / Closed-Canceled.

    Yes, this restriction is also needed in the mobile app and was able to be implemented there without issue.

    This RTWF issue is currently being investigated by Microsoft Support.

    ------------------------------
    Paul Richards
    BlueCrest Inc
    Danbury
    ------------------------------

    The first step toward cloud success. - Migrate from CRM to D365 with expert guidance from Microsoft. I'm Ready


  • 12.  RE: RealTime Workflow Error

    SILVER CONTRIBUTOR
    Posted 7 days ago
    Well, as I suspected this is a bug.

    From MS Support Team a few minutes ago:

    I got an update from the backend team, and they have recognized that this is a recently introduced bug.  Being that this bug is newly identified, there is no ETA, I can provide, unfortunately. 

    Thank you all for your replies and suggestions.



    ------------------------------
    Paul Richards
    BlueCrest Inc
    Danbury
    ------------------------------

    The first step toward cloud success. - Migrate from CRM to D365 with expert guidance from Microsoft. I'm Ready


If you've found this thread useful, dive deeper into User Group community content by role