How to export/print the schema builder effectively with all details I need? - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
Martin OMartin O 

How to export/print the schema builder effectively with all details I need?

The problem?

I took over operations at my org recently and the data model is a mess. There are tons of objects that are not used and there have been fields created here and there that are abandoned, not set up properly or partially populated a long time ago. Just to give you an idea, for leads there are almost 30 standard objects, but 80+ custom objects, but on contacts, 30 standard and 47 custom objects. On accounts we have 24 standard and 35 custom fields, with barely any validations and there are definitely missing relationships between objects.

What do I need?

Now, to start an overhaul I want to get a view of the big picture - list all objects, bucket them in "used", "will probably delete" and "have to investigate". Due to the high number of custom fields and messed up or missing relationships I am looking for a way to use Schema Builder on steroids - I need to be able to see the all objects with their full list of elements (Schema Builder allows you to see a full list only when you click Show more if the list is longer, which is the case with most objects I deal with), differentiate system, standard and custom, display both element names and element labels ideally, show all elements and distinguish between custom and standard, show which fields are mandatory, what the field types are, what the relationship between a specific field and fields from other objects is (lookup and master record relationships), tell managed packages apart (since I need to get rid of a bunch of those too). The bolded bits aren't possible in Schema Builder.

What did I try?

I did try to use the only really usable related plug-in/app ERD Tool https://appexchange.salesforce.com/listingDetail?listingId=a0N30000003KNErEAO&tab=r but I need to work with at least 6 objects to start with, 11 would be the expanded bunch I really need to evaluate for the job to be complete and this tool is cumbersome in the way it visualizes it, has no way to save them, has no way to print them and does not use the naming that SFDC gives objects which makes it even harder to work with as I have to examine each Standard Object I'm granting it access to. It also doesn't fulfill most of the features Schema Builder now has.

I also managed to use SchemaPuker to get the PostgreSQL Schema Output for our Salesforce ERD. The problem is - where do I plug this in? I tried to use LucidChart, but when I dump 6 objects on it makes it impossible to work with already, not to mention that most of the things Schema Builder does are lost in the process and I'd have to reinvent them, so an inconvenient UI is a dealbreaker. I read that I could use a Visio export from LucidChart but hit a wall with actually getting access to that. First I use a Mac and Visio by MSFT is available on the web only for viewing, not to mention that my org doesn't seem to have a VIsio license.

Can anyone help? If I don't have this foundation it would take me significantly more time to nail down the areas I want to improve and prioritize.

Best Answer chosen by Martin O
Devanand ManiraoDevanand Manirao

Hi Martin,
Since you have so many fields it may not be a good idea to depend on any visual tools.
If you an excel person, you can look dumping all your objects, fields into an excel and analyse them one by one.

Tools and Ways to fetch metadata into an excel...
You can run this from workbench and export as CSV
workbench.developerforce.com/query.php


Here is a sample query that can give you a list of fields on the account object.

select id,DataType,NamespacePrefix,DeveloperName 
from FieldDefinition 
where EntityDefinition.QualifiedApiName = 'Account'

To get a list of objects (entities) you can use this SOQL 

SELECT DeveloperName,DurableId,Id,QualifiedApiName,RunningUserEntityAccessId FROM EntityDefinition limit 100


Refer to 
https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/tooling_api_objects_entitydefinition.htm




https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/tooling_api_objects_validationrule.htm?search_text=validation

select id from ValidationRule - list of all validation rules (doesn't work from workbench) but can try from query editor in developer console (Enable Tooling API checkbox)




Workbench gives u a list of all metadata components but cannot downloaded i guess.

https://workbench.developerforce.com/metadataDescribeAndList.php?type=ValidationRule


If you manage to make use of this and create some smart excel templates please do share with the wider community will be handy .

There are other ways to get metadata but i feel for the type of review you want to perform and cleanup excel is better ., you can easily add some columns to mark which fields you want to remove, which are retained etc.. 
Thanks,
Devanand

All Answers

Devanand ManiraoDevanand Manirao

Hi Martin,
Since you have so many fields it may not be a good idea to depend on any visual tools.
If you an excel person, you can look dumping all your objects, fields into an excel and analyse them one by one.

Tools and Ways to fetch metadata into an excel...
You can run this from workbench and export as CSV
workbench.developerforce.com/query.php


Here is a sample query that can give you a list of fields on the account object.

select id,DataType,NamespacePrefix,DeveloperName 
from FieldDefinition 
where EntityDefinition.QualifiedApiName = 'Account'

To get a list of objects (entities) you can use this SOQL 

SELECT DeveloperName,DurableId,Id,QualifiedApiName,RunningUserEntityAccessId FROM EntityDefinition limit 100


Refer to 
https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/tooling_api_objects_entitydefinition.htm




https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/tooling_api_objects_validationrule.htm?search_text=validation

select id from ValidationRule - list of all validation rules (doesn't work from workbench) but can try from query editor in developer console (Enable Tooling API checkbox)




Workbench gives u a list of all metadata components but cannot downloaded i guess.

https://workbench.developerforce.com/metadataDescribeAndList.php?type=ValidationRule


If you manage to make use of this and create some smart excel templates please do share with the wider community will be handy .

There are other ways to get metadata but i feel for the type of review you want to perform and cleanup excel is better ., you can easily add some columns to mark which fields you want to remove, which are retained etc.. 
Thanks,
Devanand
This was selected as the best answer
Graham ReidGraham Reid
Hi,

We have a free app - Field Dumper - in the Appexchange that might be of interest - It will extract out your objects and fields into to a single Excel file - each object is presented as a separate Excel tab.  Api name, field types, size, help text, formula text and picklist values and more is extracted.   It uses standard salesforce schema descibe calls mentioned above.

https://appexchange.salesforce.com/listingDetail?listingId=a0N3A00000EJg2hUAD

Let me know if it helps anyone out
Alexis KasperavičiusAlexis Kasperavičius
Another tool I've used in similar situations is BOFC - it not only lets you export fields as excel, but you can update & create new fields from an excel sheet (including updating formulas), update help & description fields, permissions, and even clone fields from object to object, even across salesforce orgs.

It has saved me days of work. It's not free, (I think about 200 a year) but they charge only for your license (regardless of users) and you can transfer your license across orgs. 

No connection with them, just a fan.

https://www.bofc.io/