SchemaSpy : A free tool to generate data model (ER Diagram) for salesforce

Relationships

Inbuilt schema builder of salesforce.com does provide the capability to generate the data-model of objects. But you can’t export it in any format, and it is very difficult to visualize it when the list of objects are growing (more than 30 objects).

There are various tools out their to create ER Diagram, but either they requires good amount of investment to purchase the license of those software, or the free tools are limited in capabilities and requires lot of manual task. Which becomes pain when the objects are more than 100.

SchemaSpy

It is a java based command line tool that can be executed in windows or mac machine (have not tested on Linux). It gets connected to salesforce.com through your username and password+security token, and analyzes the objects and their relationship, to generate a visual ER Diagram with the help of Graphviz. To get more detailed information please visit the project page.

Installation

Prerequisites :
Prior to starting installation of schemaSpy following should already be installed and configured on your system -

  1. Apache Ant — https://ant.apache.org/bindownload.cgi
  2. Salesforce Ant Migration Tool — https://developer.salesforce.com/docs/atlas.en-us.daas.meta/daas/forcemigrationtool_install.htm
  3. GraphViz — http://www.graphviz.org/download/

Folder structure :
I created a folder named as — “schema” inside my-documents.
inside which following should be the structure —

Required files:
Download the following files from here — https://code.google.com/archive/p/force-metadata-jdbc-driver/downloads

  1. force-metadata-jdbc-driver-1.4.jar
  2. generated-sforce-partner-18.jar
  3. force.properties
  4. depends.zip — extract all files from it.
  5. Also download latest version of schemaSpy_*.*.*.jar from here — https://sourceforge.net/projects/schemaspy/files/

Keep all files on to “schemaspy” folder as shown above in the diagram.

Configurations :

In the parent directory there is a file —

build.xml

which will need to be updated as per the requirement. I did connected to sandbox org instead of production org. So following configuration is set accordingly -

build.xml

Running the application :
Open your preferred command line application. I did used command prompt in windows 10. Navigate to the directory — ‘schema’ where build.xml is stored, using command line, and execute the following command -

C:\Users\pankaj\Dcouments\Schema>ant

It will then generate list of HTML files inside ‘doc’ folder.

Just open the …

index.html

file from inside the doc folder, and you are good to go.

Browse to tab ‘Relationship’ from the browser, and all ER Diagram will be presented here.

Errors :

While running the Schemaspy I came across 2 errors —

  1. Illegal group reference —

When I analyzed it, found that there is $ (Dollar) symbol being used in my password. So to ignore that, we can add a backslash (\) just before the dollar symbol ($). It will not affect the password.

2. Failed to connect to database —

The default URL to be used to connect to salesforce is of Production, i.e. ‘login.salesforce.com’, but I was trying to connect to sandbox Org (as my credentials were of sandbox). So to change the URL, modify the ‘build.xml’ , and add following line —

<property name="sf.url" value="https://test.salesforce.com/services/soap/u/18.0"

under the <project> tag. And following line —

<arg line="-connprops url\=${sf.url};">

under the <java classname> tag

References :

  1. https://blog.jeffdouglas.com/2010/05/12/running-the-force-metadata-jdbc-driver-for-schemaspy/
  2. https://medium.com/@vaibhavmwarpe/schemaspy-a-tool-to-generate-data-model-of-salesforce-org-7aaa47c04186

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Automate DevOps with hyper — One API, many Services…

.NET Upgrade Assistant — Asp.Net Migrations from .Net 2.1/2.2/3.1/4.6/4.8 to Asp.Net 6

A Typographic Trick for Software Engineering Leaders to Prompt Better Ideas: The Leading Bullet

A Gentle Introduction to Computer Vision, Part 1: Compiling OpenCV on the Jetson Xavier NX

How sorted array process faster than Unsorted array? (in short Branch Prediction)

•twins• . . Done at @polifamous_tattoo_atelier Using @water_law_tattoo butter an…

How to Add the Syncfusion Blazor Chips Component to a Blazor WebAssembly App

Flutter: A Portable UI Framework For Mobile, Web, Embedded, And Desktop

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Pankaj singh

Pankaj singh

More from Medium

No Code Salesforce Integration with Cognism

Salesforce to Salesforce Integration using REST Webservice

Saving $$ with Salesforce

Interview Questions on Future Method in Salesforce