How to delete a system filter?

Nov 23, 2011 at 7:54 AM

Hi,

the plugin is greate and I was looking for it a long time.

I 've created a system view according to the instruction in you're blog. Everything worked fine.

But how can I delete this system view if I made a mistake?
I did try it with the AgRetrieveView where I've selected the "System Filter" in the lookup for the "System View". Then I use the AgDeploySystemView and insert the returning guid from AgRetrieveView and insert "Delete" in the field "When Existing". I get the following error:

Unhandled Exception: Microsoft.Xrm.Sdk.InvalidPluginExecutionException: System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: The SavedQuery(13adc872-a115-e111-8a49-005056b1000c) component cannot be deleted because it is referenced by 1 other components. For a list of referenced components, use the RetrieveDependenciesForDeleteRequest. (Fault Detail is equal to Microsoft.Xrm.Sdk.OrganizationServiceFault).
   at Gemina.CRM2011.WF.LdgManager.AgCodeActivityBase.Execute(CodeActivityContext executionContext)
   at Gemina.CRM2011.WF.LdgManager.AgDeploySystemView.Execute(CodeActivityContext executionContext)
   at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
   at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

In the workflow there is also an a hint that the "component cannot be deleted because it is referenced by 1 other components".

What am I doing wrong?

Thx and best regards

Thomas

 

Dec 6, 2011 at 1:15 PM

I made it.

The problem occurs when you try to delete the system entity an you still refere to it in an other or the same workflow.
E.g. I first used the retrieve "AGRetrieveView" to get the id of the outlook system query. Then I used this id in the next step to delete the system view by using "AGDeploySystemView". When I did run the workflow I have always got the message that I can't delete the system view because one or more components will need it. And yes sure, the AGRetrieveView needs the system view. Something to think about.

Solution:
I use the AGRetrieveView to get the id of the system view (select and open it) and then delete this "retrieveview step" from the workflow. After this I  enter the id as string in the AGDeploySystemView. Everything worked fine.

I hope someone will help this.

Thomas

Coordinator
Dec 12, 2011 at 3:53 PM

Thank you Thomas, well done. I actually wrote a response to you right away using the reply-via-mail functionality of codeplex but it got rejected (I wonder if that functionality works at all). Anyway, you described the problem and the solution already. Just to let you know, I'm working on a special new activity (Delete System View) that allows you to delete a System View directly, therefore eliminating the problem. I'll keep you posted when it becomes available.