I'm trying to find an automated way to mass delete picklist values. I had a look at the following ways to accomplish this but without success:

  • Force.com IDE: Deleting the picklist values in the metadata makes them Inactive when uploading
  • Using a Javascript hack: http://johan.karlsteen.com/2013/04/20/mass-deleting-picklist-values-in-salesforce-with-ajax-javascript-hack/ which was not working anymore due to the deprecated synchronous XMLHttpRequest. Converted to code using jQuery to async processing but didn't work. Seems like the page to replace the picklist values is stopping the deletion
  • Destructive XML on Picklist value
  • Changing type to Text and back to Picklist: Picklist values will be auto created based upon distinct data

Any other ideas?

  • delete picklist values from the metadata? Did you consider using the Apex wrapper on the metadata API from FinancialForce on GitHub? – cropredy Mar 6 '15 at 1:44
  • Hi Crop, tought about it but due to compliance reasons, we cannot just install code without approval. Which will take a some time so looking for an alternative. – Robin Wijnen Mar 6 '15 at 7:41
  • Btw: deleting the values from the metadata and redeploying marks them as Inactive. – Robin Wijnen Mar 6 '15 at 7:41
  • @cropredy i'm having troubles deleting values from picklist using the wrapper. I mean, I can disable values, modify its contents and add news. But once a value has been added to Inactive values I cannot delete it. – Alexander Aeons Torn Feb 7 '20 at 13:30
  • @AlexanderAeonsTorn - this should be posed as a new question with relevant code – cropredy Feb 7 '20 at 14:17

I am using a Chrome extension which lets me multi select a series of links and open as many tabs. This is done by selecting an area on the web page via right click. If you select multiple "Del" links then this will address your need.

enter image description here

It's called "Linkclump" and you can find it here: https://chrome.google.com/webstore/detail/linkclump/lfpjkncokllnfokkgpkobnkbkmelfefj?utm_source=chrome-app-launcher-info-dialog

It will only work if most of the values are on the same page but is still a time saver.

Hope this helps. :)

  • I don't think this solution is working any more. The extension still works, but it does not recognise the 'Del' links as links it can open on the page. they don;t get highlighted or counted when selecting them. I suspect this has something to do with them being javascript links. – Garywoo Aug 12 '20 at 11:38
  • I agree. I am having issues as well on my side... :/ – fcathala Aug 13 '20 at 12:17
  • 1
    @Garywoo you have to switch to Salesforce Classic to use this technique. In Lightning they are javascript links, but in Classic they are clickable links. – Tim Lewis May 20 at 17:41

The following solution has worked for me, but only involving custom picklist fields... you might be able to get it to work for standard picklist fields, though!

Just create a bookmark in Chrome (I’ve only tested this in Chrome but this should work in other browsers too I'm assuming...)

Paste the following code as the URL of the bookmark:

javascript:/* Gather all of the a elements on the page. */var links = document.getElementsByTagName("a");/* Pick out the Del links. */var delLinks = new Array();for (var i = 0; i < links.length; i++) {  var link = links[i];    if (link.innerHTML == "Del") {    /*alert("Del link found!");*/    /*alert(link.attributes['href'].value);*/    delLinks[delLinks.length] = link;  }}/* Open each Del link to delete the associated   picklist value.      This code can be augmented as desired   to only delete certain values.      However, for custom picklists it's probably   easier to just delete all of the values   and then re-add the desired values. */for (var i = 0; i < delLinks.length; i++) {  var delLink = delLinks[i];  xmlhttp = new XMLHttpRequest();  xmlhttp.open("GET",delLink.attributes['href'].value,false); xmlhttp.send();  }

Finally, navigate to the picklist configuration page, and click on the bookmark.

Since the requests are synchronous, the page will appear to hang, and Chrome may ask you to kill the page.  Do not kill it, just wait it out. In my case, it didn't appear to do anything until I simply refreshed the page.

The only known flaw with this approach is that the last value of a picklist cannot be deleted.  This means there is always 1 value left.

Please thank http://www.wentari.com/2013/09/mass-delete-picklist-values-in.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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