The Microsoft Dynamics CRM Team Blog
News and views from the Microsoft Dynamics CRM Team
This blog post will cover custom filter-based mass record deletion for a given entity System.
In this article, I will walk you through some scenario-based examples that I hope will provide some clarity for your CRM implementation. Because there are so many ways to use CRM, I've tried to cover the most common scenarios.
Note: If you are looking for Migration Deletion support in Data Migration Manager, then please read following blog post instead: http://blogs.msdn.com/crm/archive/2008/03/13/migration-deletion-support-in-data-migration-manager.aspx.
Scenario 1 – Undo Imports
I ran data import for some entity but then realized that the data is now obsolete and not relevant anymore and wish if I can undo this import.
For Example: Campaign responses I imported are no longer relevant as campaign is not being pursued anymore due to some reasons.
Here I am assuming that you know about how to do data import in MS CRM. Otherwise, you can read more from this blog post
a. Launch MSCRM and on the left navigation, click Imports.
a. Launch MSCRM and on the left navigation, click Imports.
b. In the right side, select the import (in this example, “Recall Campaign Responses”)
c. In the grid toolbar, click on “More Actions”
d. Under “More Actions” menu, Select “Delete Imported Records” option
e. The dialog box appears with these options:
i. Name for Bulk Delete job against this Import. ii. You can configure it to send email Notification to your outlook on your CRM email id. Additionally, you can chose to notify others on completion of this Bulk deletion for the imported records. iii. Optionally, you can also choose to delete the Import job entry for given Import targeted for bulk deletion. This is the import job entry you see in import job grid view (see above figure). It is recommended not to use this option if user wants to keep the import job entry as it also serves as reference to know when, what all imports were run. As such deletion of this entry has no other significance or side affect.
i. Name for Bulk Delete job against this Import.
ii. You can configure it to send email Notification to your outlook on your CRM email id. Additionally, you can chose to notify others on completion of this Bulk deletion for the imported records.
iii. Optionally, you can also choose to delete the Import job entry for given Import targeted for bulk deletion. This is the import job entry you see in import job grid view (see above figure). It is recommended not to use this option if user wants to keep the import job entry as it also serves as reference to know when, what all imports were run. As such deletion of this entry has no other significance or side affect.
Scenario 2 – Deletion of stale data (not relevant to business anymore)
Example 2: I find that there is need to delete the leads converted to opportunities. But how do I do it; it runs across multiple pages even if I increase page size to 250 records)?
If there is some way to do so, it will really make my life easy.
Yes, it is possible to do so in CRM live. Simply follow these steps:
1. Launch MSCRM and on the left navigation, click Sales.
2. Under workplace, click on Lead entity.
3. In the right navigation, select the view “Closed Leads”
4. Under grid toolbar select the menu bar “More Actions”
5. From “More Actions”, select the option “Bulk Delete”
6. This will launch “Bulk Delete Wizard”. Complete the wizard using the following instructions:
a. Define the Search Criteria using Advanced find query view
(This will open with the query for selected view)
b. Once you have defined the query to target records for deletion, click Next.
c. The next screen in the wizard provides you the following options:
i. Name – name of the bulk delete job. A default name will be auto populated but you can change it to make more meaningful e.g. closed leads deletion job. ii. Bulk deletion job start time – the date and time populated is the according to the time zone user is in. e.g. if user is in IST time zone then user will date/time as see GMT +5:30 hours. iii. Next is checkbox – Run this job after every – this corresponds to recurrence setting. On selecting this checkbox, the dropdown below will become active. This dropdown will show the default recurrence option (in terms of days). If your choice is not there in the dropdown then you can manually enter a value (it should be a value between 1 and 365) iv. You can choose to send email to you and optionally others as well.
i. Name – name of the bulk delete job. A default name will be auto populated but you can change it to make more meaningful e.g. closed leads deletion job.
ii. Bulk deletion job start time – the date and time populated is the according to the time zone user is in. e.g. if user is in IST time zone then user will date/time as see GMT +5:30 hours.
iii. Next is checkbox – Run this job after every – this corresponds to recurrence setting.
On selecting this checkbox, the dropdown below will become active. This dropdown will show the default recurrence option (in terms of days). If your choice is not there in the dropdown then you can manually enter a value (it should be a value between 1 and 365)
iv. You can choose to send email to you and optionally others as well.
d. Here, clicking next will take you to the Summary screen where you can review the options selected. This gives you chance to ensure that everything is as you desired, if not, go back make the appropriate changes and come back.
e. If you chose to Submit here, it will create a bulk delete job in CRM. Since this job is of asynchronous nature it may take some time for the job to start the record deletion. It further depends on the size of targeted record set on how much time it takes to complete the job.
Scenario 3 – Can I schedule the deletion for recurrence?
Well, I had good first time experience using bulk deletion wizard. But how can I use it to delete on periodic basis?
For Example: How do I use Bulk deletion wizard to delete my converted leads for last 30 days?
Step 6c in above scenario will answer your question. Having said that, if you have incorrectly set the recurrence in the first shot you can change it now (provided there is some recurrence pending according to old recurrence)
Do the following:
Scenario 4 – running out of quota, need to free up some space
I am running out of live space quota, need to free up some space. Your options are:
Narrow down the view in ‘Systems jobs’ screen by selecting Type=’Bulk Delete’ and View=’Completed System Jobs’ [screenshot below].
Now select the specific system jobs and delete. This will also clear the records created to captures failure information corresponding to the selected jobs and release space.
Possible reason is that you have selected the “Recurring System Jobs” view and tried to delete the job that has recurrence still pending.
To delete a recurring job that has recurrences yet pending, the job has to be cancelled first:
Now you should be able to delete this recurring System job from settings ->System Jobs. However, while this ensures that the job will occur in future, to release the space utilized for storing failure information of the previous instances of this job, you need to delete those instances as explained in sl. 1 above.
Now that you know the power this functionality provides, you can build your own scenarios.
Frequently Asked Questions (FAQ):
Scenario 3 answers your query.
Scenario 2 will answer your query
It will be the user who creates the bulk deletion job.
No, in that case you won’t get any email. Hence it is advised that instead of deleting these email templates customize the same to suit your needs. The name of the templates is as follows:
No. Please customize system templates as per your own need. Do not delete those.
Firstly, the summary screen, that appears just before the delete job is submitted, specifies how user can view the status of the job submitted. Secondly, on completion of the job, user will get email notifying if the job has completed with failures or success. The email body also clearly specifies how to navigate to the particular screen where user can view the job status.
Yes, the date and time shown in the wizard is as per client time zone.
This is currently a limitation where the hyperlink works fine for on premise deployments. This will be fixed in next version.
In single organization environment, you might give a try to replacing '@servername' with fully qualified name in the following email templates:
I should warn you that in multi organization environment there might not be a workaround which works for all.
A bulk delete job with more than few 1000 records to delete can be effectively paused, for smaller size by the time user pauses the job would have already executed (batch size is one thousand records).
If the records you are deleting have child records, and cascading delete exists (such as Contacts that have a Parent Customer set to an account), it takes longer for the bulk delete to complete.
A bulk delete job fails for perfectly valid business reasons and not for any technical limitation of the feature. As an example, if user tries to delete a territory without first deleting all the accounts associated with that territory, the delete action will fail. These are in-built deletion constraints in CRM; Bulk Delete feature is not introducing anything new here, but just utilizing the existing deletion framework.
The texts are UE scrubbed and we are confident that the instructions are easy enough to understand.
From the job status view, user will come to know why a record could not be deleted. He will then take corrective functional actions before submitting the delete job again (For example, now perhaps he will first submit a job to delete all accounts then the job to delete territory).
Failure details are required to be stored displayed so that user can address the problem. However, like any other record in CRM, failure details will also consume space. Hence after viewing the detail for the failed job, user may like to delete the record by simply clicking the delete icon on the top of the grid. Here user can also multi-select records and delete. This is exactly similar to how user can delete a record from any other grid view like account, opportunity, leads etc.
If a recurring bulk delete job (for such jobs, user sets a frequency in which the job will re-run automatically) fails and user does not address the cause (viz. ensure that accounts are deleted before territory…etc.) then in subsequent recurrences also the job will fail adding new records to the failure table. If this continues to happen for a number of recurrences the failure records will continue to accumulate.
Resolution for space release: The past occurrences of the Bulk delete job can be deleted releasing space. Also, the recurring job itself can be canceled and deleted preventing any future occurrence.
Related blog Post(s)
You can also save on your live space by deleting any duplicates. For more details read this blog post:
PingBack from http://microsoftnews.askpcdoc.com/data-management/bulk-record-deletion-in-microsoft-crm-online
How come scenario 2 and 3 not is not available in other CRM 4 editions?
Hi, how do you add the "bulk delete records" option there, in Scenario 1 picture d. I only have share option in my crm
I haven't found "Delete Imported Records" option under the "More Actions" Button in the Imports from the Left Navigation Bar!
Any reason for this, kindly let me know. Its making me curious.
Hi, how did you get the option "bulk delete records" in scenario 1 picture d?
I only have "share..." there.
I have seen couple of comments here about the availability of this feature.
This features was developed as part of "CRM Online" which went online on April 14, 2008
Note: If you have EA1, EA2 online release then this feature won't be available.
in online context this feature make more sense as there is given quota of space and people have a natural need to manage this space to run business smoothly.
If there are more queries, let me know.
We are using CRM server not online. I'm wondering is there a any to add this function into our CRM server. There is a sample code in CRM SDK 4.04 package called "bulkdeleteoperation.cs". Is this code for this function?
Why is bulk deletion services not available for the on premise CRM and or can it be added easily?
the UI was released specifically for Live and am not sure when it will become available in on premise. But yes, using platform on can write a custom bulk deletion feature.
sample code in CRM SDK 4.04 package called "bulkdeleteoperation.cs" is meant for the same purpose.
also read - Bulk Delete Operation Entity Capabilities and related entries in the SDK
I installed the 90 trial of CRM 4.0. I do not have the "Delete Imported Records" option. Is that for Online Version Only?
I ave a business requirement where i need to retrieve and show in the custom page only the latest record entered for an entity say account.how can i acheieve this using SDK
Those Zune guys make it look so easy: Zune 4 = up to 1,000 songs, while Zune 120 = up to 375 hours of
I would like to use the Bulk delete option but it is not presented when following the steps in Scenario 2 – Deletion of stale data (not relevant to business anymore)
I have System Admin role and System Customizer role whatelse do I need to use Bulk Delete?