Search code examples
salesforcesalesforce-lightningsalesforce-flow

Is there a way to create a link to the latest version of a given flow in Salesforce?


In the salesforce documentation for my job, we have some links to flows that are being described. This lets someone reading the documentation easily access the flow to view or edit it. However, the link only takes you to the specific version of the flow that you copied the URL from, and so the links in the documentation will need to be updated whenever a flow is updated to a new version. This is inconvenient and I would like to know if there is some way to create a link that automatically takes you to whatever the latest version is.

I tried the instructions here but the url created using these steps executes the flow when clicked rather than bringing you to the editing page like I want.


Solution

  • You could experiment with querying some stuff if you need to regenerate the docs. Metadata API distinguishes between "Flow" and "FlowDefinition" but normal query can work pretty OK too.

    https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_flowdefinitionview.htm

    SELECT DurableId, ApiName, ActiveVersionId, Description, Label, LatestVersionId, ProcessType, VersionNumber
    FROM FlowDefinitionView
    WHERE IsActive = true
    

    "DurableId" should start with 300 prefix and let you construct the link to "view details and versions" page (with some escaping like /lightning/setup/Flows/page?address=%2F3005J000000CnN4QAK). Or use ActiveVersionId to construct link with 301 prefix to actual editor page (/builder_platform_interaction/flowBuilder.app?flowId=3015J0000009DOYQA2)