Tuesday, December 01, 2015

Removing RecordType from Profile using Metadata

I thought that this is going to be my worst experiment ever!!I should not done this especially when I have other important task to do.

I tried to figure out how to embed inline visualforce in Page Layout for Standard Edit, so I creating RecordType and hope it will help.But it won't;there seem no choice to embed inline visualforce based on the Answer here.

Anyway,back to accident RecordType.I am not able to delete it because it prompt me to deactivate it first.Again when I tried to deactivate it,it prompt error because it said it being used by these profiles.

This record type Common Component cannot be deactivated because the following profiles use this record type as default.

These profiles are more that 200(Actually to be exact 243).How I am going to navigate each profiles through browser and change the setting--it's going to take me forever.

*just normal office chat*

After few tries,it works.Nah,here the metadata that I append in my package.xml .So as you can see , I retrieved all.
*Note:You can select recordtype specific of the object that you want to choose by putting it .

The reason to only retrieve the specific recordtype is to avoid any unnecessary error that might related to  other recordtype.Well,based on my experience :messing with recordtype is not fun.

Change default true to false and visibility true to false as code above.Copy paste it to every Profile that you want to change.Then commit to server.

You can see it change in the Salesforce like below:

After this,I am positively can deactivate and delete the record type easily