Changing default record type for ALL profiles

I just spent 20 minutes changing a custom object’s default record type for every profile that we have. For future reference, is there a way to change this across all profiles?

Answer

Not in one shot. The best I think you can do this via the Force.com Migration Tool and the metadata API. You would need to perform the following steps:

  1. Download all of the profiles. This is easy since the wildcard operator works with Profiles.
  2. Open each file (they’re XML), find the entry, and update it. It will look like this:

    <recordTypeVisibilities>
    <default>true</default>
    <recordTypes>MyObject.NewDefaultType</recordTypes>
    <visible>true</visibles>
    </recordTypeVisibilitiess>

  3. Upload the new metadata

Assuming you can do a global find and replace I think this would be easier than clicking through the web UI.

Caveat: This may only work on custom objects; the Metadata API does not work completely with standard fields on standard objects. Since you mentioned custom object it would probably work fine.

Attribution
Source : Link , Question Author : dannymorty , Answer Author : Mike Chale

Leave a Comment