You need to sign in to do that
Don't have an account?
Patrick Hanahan
How to find all duplicate Opportunities?
I'm trying to clean up my SalesForce a bit, and realized I have many Opportunities that are duplicates of each other. For me, duplicate Opps means multiple opportunities with the same "Job Number" which is a custom field. I tried to make it a unique field, but it won't allow me to do that until all duplicates are deleted.
So I'm trying to write some code that finds all duplicates at once and lists them so I can go through and delete the redundant ones.
I would like to just write a function that loops through all the Opps and checks like this. (pseudo code)
So I'm trying to write some code that finds all duplicates at once and lists them so I can go through and delete the redundant ones.
I would like to just write a function that loops through all the Opps and checks like this. (pseudo code)
for ( Opportunity O: All Opportunities) { for ( Opportunity I: All Opportunities) { if O.jobNumber == I.jobNumber display I; } }I just don't know if theres anywhere to plug that in. A report maybe? Is there anywhere I can access the entire database of opportunities and find specific ones in this manner?
In the developer console (Setup> developer console) you can run below query Then you'll be able to see opportunities with the same job number.Then you can edit records or delete multiple records manually there.
Best regards
All Answers
In the developer console (Setup> developer console) you can run below query Then you'll be able to see opportunities with the same job number.Then you can edit records or delete multiple records manually there.
Best regards
I tried adding "HAVING COUNT(Job__c) > 1" but it gave me an unknown error.
And again, thanks for the help.
From the below query we can identify the opportunities which are duplicated by using 'group by' clause. but the problem is the delete option is not working when we use group by clause regards
.