Lightning-Flow-Scanner / lightning-flow-scanner-core

A rule engine capable of conducting static analysis on the metadata associated with Salesforce Lightning Flows, Process Builders, and Workflows.
https://www.npmjs.com/package/lightning-flow-scanner-core
MIT License
27 stars 9 forks source link

New Rule: check if flow is saved in auto layout #32

Closed fkramer690 closed 6 months ago

fkramer690 commented 1 year ago

Sometimes a record-triggered flow is not showing in the trigger explorer if it is not saved in the auto layout mode. Apart from that, there are more benefits to do so.

I assume for you it is an easy one to check the tag and return true / false

<processMetadataValues>
    <name>CanvasMode</name>
    <value>
        <stringValue>AUTO_LAYOUT_CANVAS</stringValue>
    </value>
</processMetadataValues>
RubenHalman commented 1 year ago

I was not aware of this. How should we formulate the recommendation we can give to a user? Would you happen to have sources or be able to elaborate on this further?

fkramer690 commented 1 year ago

This feature seems to be in beta, but at least that is my recommendation. The auto layout will give you a tree-like representation of the flow and makes it easier to understand the logic from top to button. apart from that, Salesforce does not let you create unconnected elements.

https://help.salesforce.com/s/articleView?id=release-notes.rn_forcecom_flow_fbuilder_autolayout_mode.htm&release=228&type=5

FREE_FORM_CANVAS is the value which should not be used AUTO_LAYOUT_CANVAS is the correct one Below you will see that sometimes record-triggered flows are not showing up in the flow trigger explorer if saved in free form. Saving the flow in an auto-save layout will fix the issue. Since this is only appearing for record triggered flows, this can may be filtered to flows with Flow_enabled **CreateAndUpdate** image image
RubenHalman commented 1 year ago

To be honest, I agree and this is an easy rule, but it also makes me think we ideally need 'Beta' rules. My proposal would be that this becomes an included best practice as soon as the feature is not in beta anymore?

SFDX-Sam commented 1 year ago

For what it's worth - auto layout is generally available: https://help.salesforce.com/s/articleView?id=release-notes.rn_automate_flow_builder_autolayout.htm&release=236&type=5

I think it's a good practice to have flows automatically laid out - it greatly increases readability