25

I want to remove the Record Type applied to a Custom Object. There will be no record types at all.

I cannot remove one of the record types because its set to the default for several profiles (in fact all profiles). Therefore it seems like I have to manually enter each profile and delete it. Joy.

However, for Chatter type profiles I don't have the option to enter "Object Settings". So I can't remove it it from these profiles. Which means I can't remove the Record Types attribute at all.

Any ideas how to get around this?

Ideally I'd like a page, like the one I was offered when I created the record type, that lists all profiles and has a picklist for each row ('default on' or something).

The only "solution" I found was this: https://success.salesforce.com/answers?id=90630000000h2pXAAQ which seems like its out of date now. I can't navigate to a setup/ui/profilerecordtypeedit.jsp page as described in that link.

2
  • Have anyone tried to remove recordtype using metadata?
    – unidha
    Dec 1, 2015 at 8:04
  • I don't think that will work. It's a Salesforce feature that record types cannot be destroyed via metadata API. This is probably because a replacement record type has to be provided, which requires user interaction.
    – powlo
    Dec 1, 2015 at 13:10

5 Answers 5

43

Clues came from here:

http://sfdciq.com/unable-to-delete-record-type/

The solution is a URL hack.

https://xxx.salesforce.com/setup/ui/profilerecordtypeedit.jsp?id={Profile ID}&tid={Custom Object ID}&pn={Profile Name}

Eg,

As a System Administrator, I go to Setup > Profiles > the profile I'm interested in. Lets say "Chatter External User"

The url for this profile contains the Profile ID: https://xxx.salesforce.com/00e20000001nAgo

I also have to copy the Profile Name: "Chatter External User"

Then I go to Setup > Create > Objects > the object I'm interested in. Let's say "Custom Object"

Again the url contains the tid:

https://xxx.salesforce.com/01I20000000y7Hh?setupid=CustomObjects

My final hacky URL is:

https://xxx.salesforce.com/setup/ui/profilerecordtypeedit.jsp?id=00e20000001nAgo&tid=01I20000000y7Hh&pn=Chatter+External+User

NB For Standard Objects the parameter tid is the name of the object "Contact", "Account", Opportunity" etc. For Custom Objects its the ID of the Custom Object.

I can now remove the unwanted Record Type from "Selected Record Types".

Simple wimple.

4
  • I have tried using this URL hack method, but not able to do so. I am facing error message as 'Unable to Access Page'. Here is my hack URL cs20.salesforce.com/setup/ui/… , The first Id is the profile Id and the second one is custom object Id. I think salesforce has noticed this and blocked the user to access the page. Any thoughts would be helpful! May 25, 2016 at 7:00
  • The return url was missing so I have added it and It worked like Charm! Thanks for the info. May 25, 2016 at 7:20
  • you can skip the last part with the name &pn=Chatter+External+User. Just keep the ObjectID & ProfileID in the URL link
    – BBK
    Dec 20, 2019 at 14:58
  • Worked for me. +1 for you. Feb 4, 2020 at 6:28
2

Before following those steps, try the following:

Setup > Customize > User Interface > 

Disable  > Enable Enhanced Profile User Interface

Then follow the instruction, you should be able to get to the page where you can remove the record type.

1
  • 1
    This doesn't work unfortunately. Chatter profiles do not list "Record Type Settings".
    – powlo
    Sep 2, 2014 at 12:47
0

Fetch your profiles.

$ force fetch -t Profile

Replace the contents of your Chatter Profiles (Chatter External User, Chatter Free User, etc.) to disable the Record Types.

<?xml version="1.0" encoding="UTF-8"?>
<Profile xmlns="http://soap.sforce.com/2006/04/metadata">
    <recordTypeVisibilities>
        <default>false</default>
        <recordType>My_Object__c.Bad</recordType>
        <visible>false</visible>
    </recordTypeVisibilities>
</Profile>

Deploy the profiles.

$ force push src/profiles/Chatter*
0

if the above URL hacking didn't work please use the below VS code solution and it is very charm!

  1. Retrieve Profiles in VS code.

    a. If Profile is not an available folder to retrieve in VS code then need to modify the Package.xml file in VS code(VScode > Manifest > package.xml) to get all profiles. Add the below codes in the xml file

<types>
        <members>*</members>
        <name>Profile</name>
</types>
   b. Right click and retrieve from Org.
  1. Now we see the profile folder in our project folder repository. open the respective profile where default recordtype access need to be moved and add the below code and deploy to org.

    false CustomObjName.RecordTypeName false
  2. The above lines will remove default recordtype access from the profile. So after the deployment go the Object Manager > Custom Object > RecordType > Inactive.

  3. After inactivating the RecordType we can delete without any issues.

-1

This can be done by url hacking. You just need to go one more step ahead.

  1. Go to sysadmin profile.
  2. Scroll down to record type settings and click on the edit link for changing the record type of the object concerned. This will open the record type edit page for the object, for sysadmin profile.
  3. Now replace the id of sysadmin profile in the url with id of the profile you want to change; you have to do it in two places.
  4. This will take you to the page where you can remove the record type.
2
  • How does this answer provide information that is not already there in more detail on URL hacking than the accepted answer?
    – Dave Humm
    Aug 22, 2017 at 14:42
  • The URL hack given in the marked answer did not work for me, but this one did. If during any release salesforce changed the page URL (which in this case seems to have happened after enabling lightning experience and whole lot of releases), the hard coded URL hack answer might break. So, I feel that this generic answer to URL hack sounds good. While both answers convey the same idea and with little bit of brainstorming any developer could figure this out, I feel that this answer is slightly more generic and could work even when salesforce changes the page URLs
    – arut
    May 8, 2020 at 11:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .