Microsoft KB Archive/943843

= You cannot programmatically delete instances of a workflow rule in Microsoft CRM =

Article ID: 943843

Article Last Modified on 10/29/2007

-

APPLIES TO


 * Microsoft CRM 3.0 Software Development Kit, when used with:
 * Microsoft Dynamics CRM 3.0
 * Microsoft Dynamics CRM 3.0

-



Source: Microsoft Support



RAPID PUBLISHING
RAPID PUBLISHING ARTICLES PROVIDE INFORMATION DIRECTLY FROM WITHIN THE MICROSOFT SUPPORT ORGANIZATION. THE INFORMATION CONTAINED HEREIN IS CREATED IN RESPONSE TO EMERGING OR UNIQUE TOPICS, OR IS INTENDED SUPPLEMENT OTHER KNOWLEDGE BASE INFORMATION.



Action
You attempt to programmatically delete a workflow process instance using the Microsoft Dynamics CRM 3.0 Software Development Kit.



Result
You receive the following error code 0x80042602. The workflow process instance will not be deleted.



Cause
The error code 0x80042602 means that the workflow process instance has not been terminated.



Resolution
In order to delete a workflow process instance, you must first check to see if the workflow process instance has been terminated. You can terminate a workflow process instance by executing the SetStateWFProcessInstance request. Here is sample code for the SetStateWFProcessInstance request

SetStateWFProcessInstanceRequest state = new SetStateWFProcessInstanceRequest;

state.EntityId = new Guid(&quot;A VALID GUID&quot;);

state.WFProcessInstanceState = WFProcessInstanceState.Aborted;

state.WFProcessInstanceStatus = -1;

service.Execute(state);



DISCLAIMER
MICROSOFT CORPORATION AND/OR ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY, RELIABILITY, OR ACCURACY OF THE INFORMATION AND RELATED GRAPHICS CONTAINED HEREIN. ALL SUCH INFORMATION AND RELATED GRAPHICS ARE PROVIDED &quot;AS IS&quot; WITHOUT WARRANTY OF ANY KIND. MICROSOFT AND/OR ITS RESPECTIVE SUPPLIERS HEREBY DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THIS INFORMATION AND RELATED GRAPHICS, INCLUDING ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, WORKMANLIKE EFFORT, TITLE AND NON-INFRINGEMENT. YOU SPECIFICALLY AGREE THAT IN NO EVENT SHALL MICROSOFT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, PUNITIVE, INCIDENTAL, SPECIAL, CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF USE, DATA OR PROFITS, ARISING OUT OF OR IN ANY WAY CONNECTED WITH THE USE OF OR INABILITY TO USE THE INFORMATION AND RELATED GRAPHICS CONTAINED HEREIN, WHETHER BASED ON CONTRACT, TORT, NEGLIGENCE, STRICT LIABILITY OR OTHERWISE, EVEN IF MICROSOFT OR ANY OF ITS SUPPLIERS HAS BEEN ADVISED OF THE POSSIBILITY OF DAMAGES.

Keywords: kbnomt kbrapidpub kbmbsmigrate KB943843

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.