Document Your Process Builder

We often create various documents for deliverables, review, taking over, just an explanation to teammates, and so on. If the document is based on your Salesforce environment, you may create it automatically from the org to avoid maintaining both.

For example, the followings are popular tools to export Salesforce settings including object fields definition.

And some companies may have their own tools internally.

So, how about Lightning Flow? This idea has more than 3k points but the metadata of lightning flow is complex and I cannot find any open source tools that supports it.

Not found? Just make it! As a prototype, I created the following tools to document process builder setting.

Web App

Connect your org and click the download icon of the flow you want to export. PDF file will open in another browser tab. Currently this tool supports trigger-based process builder only. (And unfortunately it still doesn’t support all the process builder settings.)

CLI Extension

Install the plugin

sfdx plugins:install sfdx-flowdoc-plugin

and then run,

sfdx flowdoc:pdf:generate YOUR_PROCESS_API_NAME

Behind the Scenes

This tool simply parses Flow metadata and construct a object to generate pdf by pdfmake. For example, a criteria element in process builder is represented as <decisions> element in medatada.

You can see <connector> element and it refers to a next element like action or next criteria. Tracking this recursively, you can retrieve a sequence of action group elements.

But <decisions> represents not only criteria in process, but also evaluation of scheduled action, and of course decision in flow builder. Now I write code only for displaying process builder settings, so further studies on flow metadata are needed to make this more abstract.

Next Step

I’m working on the rest of process builder settings and flow builder settings. Your feedback is always welcomed!

(この記事は Salesforce 開発者向けブログキャンペーンへのエントリー記事です。)

Written on Mar 27, 2020.

comments powered by Disqus