|Posted: 2013-06-04 12:40|
We were recently asked how to delete Organisations which have no Employees. You can do this by either creating a report and then use a Process Engine Script or manually delete the records yourself. This example will explain how to manually delete the records.
To manually delete the Organisations you are required to create a report to show the Organisations which have no employees, mark these Organisations as 'To be Deleted' and then run a bulk delete on these records.
To begin with, create a Checkbox Custom Field on your Organisation records. To do this go to Start > Configuration > Customisation > Organisations > Custom Fields > New Custom Field > Call it 'Mark to Delete' > Select the type as 'Checkbox' > Save & Close.
Next, create a report which shows the Organisations that have no employees. To do this, please take a look at the following link which explains how to create the report. Once you have done this, export this report to CSV and then save the CSV file.
Next you need to run an Update through Import to mark these Organisations as 'To be Deleted'. To do this create a new People Import > Select your CSV file. Within the Field Mappings stage map Object Reference from your Source file to the Workbooks Object Reference field > Select 'Mark to delete' from the Unmapped Workbooks Fields section and give it a fixed value of '1', as shown below.
Your finalised mappings should look like this:
When you get to Stage 4 of the Import Wizard select 'Only update existing records' as the Import Mode and use the 'Object Reference' to uniquely identify an Organisation record.
Once you have completed the Import open the Organisations Landing Page by going to Start > Organisations > All Organisations. Then add a filter which shows all records which have the 'Mark to delete' checkbox as 'True'. Check the correct records are shown then select 'Bulk Actions' > 'Bulk Delete'.
This will then delete Organisations which have no employees.