SugarCRM: Export Workflows

sugarcrmdevelopers —  February 20, 2012

While getting ready to take stuff live for a project I came across an issue, there is no way to export workflows definitions in SugarCRM from our development environment, so we wont have to recreate them in our production environment. Updated: three issues have been fixed, click read more to see the details.

While our version control system picked up the files that were created in the custom directory, the workflows would fail to since the information didn’t exist in the database.  I solved this problem by writing a quick and dirty script to export the workflows from the tables as sql scripts.  You can find the script here.  I have to warn you that it’s very basic and only supports exporting by module currently and has a lot of room to be improved on.

Features To Add

  • Module Installable Package
  • Admin Interface
    • Ability to select which workflows to export
    • Create a module installable package that would also contain the code

Update

While using the export script, I found a few issues have been corrected and pushed up to GitHub.

  1. The Script was not select from the workflow_action and workflow_alert tables correctly
  2. The Script was not selecting the expressions for the triggers properly
  3. No way to remove stuff from the production system if we did another export/import

Ultimately my overall goal would be to have this included in the base product which is something I am already looking into.

I hope this can help someone as much as it has helped me today.

License

SugarCRM Workflow Exporter by Jon Whitcraft is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Based on a work at github.com.