[SalesForce] How to (programmatically) mass update tab visibility for all profiles

Salesforce's UI does not provide a great way to mass update profiles for many permissions. One example of this is tab visibility. Currently, we need to go through each profiles' object permissions and adjust it there. Quite a painful manual process with many clicks – especially if you've got a lot of profiles!

So say I want to make the standard Assets object's tab "Default On" for all profiles. My understanding is that this can't be done via Apex, and instead I'd have to go through the XML metadata somewhere?

I use MavensMate with Sublime, which I can use to pull profile metadata down. Is it just a matter of combing the XML file for each profile, finding the necessary value to change, mass updating and then pushing that back to SF?

Best Answer

The process you outlined is one way of going about it. Those values are accessible in the profile metadata (XML).

You can actually modify these items in Apex by using a metadata api wrapper such as Andrew Fawcett's Apex Metadata Wrapper found at:https://github.com/financialforcedev/apex-mdapi

Related Topic