[SalesForce] Can you deploy “Tab Hidden” to a Custom Object on a Profile using metadata API? (tabVisibilities)

I have a custom object called MyCustomObject.object and a custom profile called MyCustomProfile.profile

Currently the tab visibility of MyCustomObject is set to "Default On" for MyCustomProfile.

<tabVisibilities>
    <tab>MyCustomObject</tab>
    <visibility>DefaultOn</visibility>
</tabVisibilities>

If I set the tab visibility to "Tab Hidden" through the Salesforce UI, the lines above are removed in MyCustomProfile.profile and when I try and deploy this change through the metadata API the change is not reflected (i.e. the tab visibility remains as "Default On")

I was wondering whether you can access tabVisibilities in destructiveChanges.xml and deploy the tab visibility as a destructive change?

I imagine it might look something like this:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
    <members>MyCustomProfile.MyCustomObject</members>
    <name>ProfileTabVisibility</name>       
</types>
<version>33.0</version>

Thanks

Best Answer

You are not deleting anything, hence it's not part of the destructiveChanges. If you want to hide a tab, you should make a regular deployment by specifying "Hidden" instead of "DefaultOn" or "DefaultOff".