MSCRM does a pretty good job so that you don't get into trouble when removing attributes from the system. Before you will be allowed to do so, it will verify that the attribute is not being used in any published form, view, or workflow in the system. For forms and views, the error message explains quite clearly which form/view needs to be updated before the attribute can be removed.
However when it comes to workflows, you just get the following generic error:
select distinct name fromworkflow
where rules like '%custom_attributename%'and deletionstatecode = 0
and statecode = 1
and primaryentity = 112
One thing to be cautious of is that there may also be active workflow instances that reference the field that you are removing and CRM does not (in my experience) prevent the attribute from being removed on account of an active worklow instance. Only published workflow definitions that reference a particular attribute will be prevent that attribute from being deleted. This means that you should take into consideration the impact that deleting an attribute will have on active workflows that might be running. If you do so and there is an active workflow instance, you can expect to see something like the following appear in your workflow:
A similar "invalid condition" will be shown in any unpublished/draft workflow definitions that reference the deleted field.
To help prevent such a scenario from occurring, you can also query the database to discover workflow instances of the published workflow definition that you identified in the above query:
select statuscode from AsyncOperation
where Name like 'name of workflow'
and statuscode in (0,10,20,21)
Just De-activate all the processes, then try deleting the attribute. You will now know exactly which process is creating the problem. Cheers
ReplyDelete