I have created the field set as External Id and now I am changing the field to set as unique record identifier, I am not able to change, because Records exist already with duplicate values for that field.

So I want to query all the duplicate records. How do I perform a query to display the duplicate values for that particular field in test sandbox?

Then I will delete all the fields which contains duplicate External Ids, then I can change the field to Unique. Please anyone Guide me how to write a Query for Displaying the Duplicate Record Ids.


There will most likely be a formula some whizz kid can make up for you but would it not be easier to export into excel and de-dupe on a spreadsheet, amend and re-load into salesforce with data loader?

How many records are we talking?

  • How to convert it into Salesforce,guide me what i have to do – SFDC Sep 15 '16 at 8:51
  • what are the steps I have to follow to change the Unique field for the Particular field Guide Me for the Answer – SFDC Sep 15 '16 at 8:54
  • So use the dataloader - Export the data with all the fields you require including your custom field. Open in Excel - Use "Find Duplicate" on Excel Data Formatting - Highlight the duplicate values in a colour. Filter the spreadsheet to only show cells using the colour. Change the Unique field ID into whatever you want it to be - then using the Dataloader - load the spreadsheet back into SF using the mapping to update the fields. – Paul Rogers Sep 15 '16 at 9:06
  • I think this is easier to do like @Paul Rogers says with an extract using a report including the Salesforce Record Id, External Id and whichever other fields you need to identify the records to keep then load the csv to Excel and sort by the external id, highlighting any duplicates. Then for the duplicates copy the Salesforce ID to a separate sheet in Excel, save it as a .csv file and use dataloader to delete those records. – Dave Humm Sep 15 '16 at 9:07
  • For Data Loader i want query to extract data,what is the query i have to perform @DaveHumm – SFDC Sep 15 '16 at 9:12

Not the answer you're looking for? Browse other questions tagged or ask your own question.