Home > MS CRM 4.0 > Deleting Attributes used in workflow with out stoping workflow

Deleting Attributes used in workflow with out stoping workflow

Other day i need to remove several attributes from the entity.
This process is straight forward in CRM , just we remove the field from the Form and Grids
and they using the Entity Editor select the attribute and hit “delete”.
But we tried to delete the CRM showing error message saying "Attribute can’t be deleted bcoz it is used by workflow".
In our customer CRM that entity had more than 10 work flow running , unpublishing and trying to identify which workflow
use the attributes we trying to delete is tedious job.Finally we found an easy way to do this using sql query

DECLARE @Attributename VARCHAR(50)

— TODO: Update these to the entity and attribute you are working with
SET @EntityName = ‘invoke_account’
SET @ Attributename = ‘invoke_underwriter’

SELECT WFD.WorkflowDependencyId AS ‘workflowdependencyid’,
WF.Name FROM WorkflowDependency AS WFD

— Join the Workflow Table to get the Name of the Workflow
JOIN Workflow AS WF ON
WFD.WorkflowId = WF.WorkflowId AND
WF.StateCode = 1

WFD.DeletionStateCode = 0 AND
WFD.DependentEntityName = @Entityname AND
WFD.DependentAttributeName = @ Attributename AND
WFD.Type = 8 AND
WF.DeletionStateCode = 0

This will return all the dependent workflow for the attribute specified.

1.Unpublish the workflow
2.remove the attribute and dependencey.
3.Re publish

Categories: MS CRM 4.0
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: