Graphvizforce

An Entity Relationship Diagram generator in Graphviz format for Salesforce.com

View the Project on GitHub stevebuik/GraphVizForce

Why? ER Diagrams are used for communication and as a reference. Often you want many different diagrams from the same Salesforce instance. This tool allows you to save as many different diagrams as you like so you can easily change and re-generate them in the future.

You can also use the built-in template system to style the saved diagrams however you like.

This is a sample of what you can produce.

Sample

Features

Getting Started

Install this app into your Salesforce: Install into Sandbox .....or..... Install into Production

Create a folder in the Documents tab called ERD Settings . This name is case sensitive. The API Name of the folder can be anything.

To run the generator, navigate to the ERD Generator tab. You may need to make the tab visible in your Profile. Or just change the url in your browser to /apex/ERDGeneratorPage

  1. Click the Generate button to see the diagram.
  2. Now add some new fields to the diagram
    1. Click the Configure Objects tab
    2. Edit any object and choose the fields you want to see
    3. Click Generate again to update the diagram
  3. Click the Configure Groups tab to add or remove a Group and some Objects
  4. Click Generate again to see your changes in the Graphviz code field
  5. Use the Save button to save your diagram. This allows you to update it later without starting from scratch.
  6. Maybe use the Save As button in the Choose/Create Diagram tab to clone a new Diagram from the default.
  7. Install Graphviz on your computer
  8. If you want a pdf or png copy of the diagram, you can download the diagram using the "Download Graphviz File" button. Open the downloaded .gv file using Graphviz on your computer and export to the format that you need.

Templates

Diagrams are generated using a template system. Templates are Static Resources that have a description starting with #graphviztemplate. You can also use a template that is in a public Dropbox folder. The file must have a .gv extension. This is useful when changing templates because you can edit the file locally and Dropbox will automatically save it to the cloud. If you are a developer you can use Eclipse or any other meta-data editor to create/edit Static Resources instead of using Dropbox.

Note: to use a Dropbox template, you must add a Remote Site Setting in Salesforce for https://dl.dropboxusercontent.com

This means you can create custom templates if you want or you can just use the basic included template(s). If you create a nice template, please send us a sample - we'd like to include it for everyone to use.

For more info on Graphviz syntax see http://www.graphviz.org/Documentation/dotguide.pdf

The easiest way to play with templates is to generate a diagram and open it in Graphviz. Then edit the .gv in any editor and Graphviz will automatically refresh. Once you are happy with the design, apply the changes to your template and re-generate.

Project Status

We use CircleCI to automatically test the Apex code in this project.

Here is the current build status. Circle CI Don't install the app if this is not green.

If interested you can see the tests running here

Motivation

This tool was not possible using Apex until the Summer 14 Release when Salesforce removed the limits on describes.

We built it to enable anyone to generate ERD Diagrams and to share what we've learned building tools like this.

The code is split into modules to make it easier to understand for developers. There are a few techniques used in the code which you can copy and learn from:

Look at the tests to learn how to use these classes.

Roadmap

We welcome contributions from the community. If you want to add a feature, connect with one of us to ensure that someone else is not already doing it and then send us a pull request.

Here are features that we need help with

Contributors

Jason Guan Github LinkedIn Website

Steve Buikhuizen @steveb8n Github LinkedIn Google+