Skip to main content
Skip table of contents

Recipe: Steps to Create an Autolaunched Flow Button

This recipe describes how you can dynamically launch non-interactive flows from a button click in Community Hub fully through point and click. 

In this example we will create a button to launch a flow. This flow will alter an Account record(s) returned by a Query, adjusting the last name field, and updating the record(s) in the database. 

To do this, follow the below steps:

Create a Query Record

This query (See: creating a query) will return the current Account that clicks the button. The resulting record(s) from this query will be used as an input variable for our flow.

Show Me An Image...

Create a Data Source

Create a data source which uses the query created above. Enter the below values when creating the Data Source:

  • In Class, enter NC.SOQLDataSource.
  • In Context, enter the Query Name of the query created before.
Show Me An Image...

Create a Flow

Our simple example is a flow that alters the record(s) returned by the Query record, adjusts the last name, and updates them in the database. This is a simple example, but our hope is you can see additional possibilities.

Follow the below steps:

  1. From Setup, enter Flows in the Quick Find box, then select Flows
  2. Click New Flow.
  3. Select Screen Flow and click Create.
  4. From the dropdown on top ribbon, select Freeform.
  5. From the Manager tab in left navigation, click New Resource.
  6. Enter the API Name as Account_ids.
  7. Enter a description.
  8. In Data Type, select Number.
  9. Select Allow multiple values (collection).
  10. Select Available for input.
  11. Click Done.
  12. From left navigation menu, drag and drop Loop.

Create a New Button

Create a button to launch the flow created above, specifying the following:

  1. The NC.DynamicFlowButton class.
  2. The name of the Data Source we created.
  3. The name of our flow.

Expected Result

When the button is rendered in Community Hub and a user clicks it, the following happens:

  1. The query record in the data source is run, returning records to the button.
  2. The button passes in these records to the flow as input variables.
  3. The flow runs and updates the Account fields.
  4. The button completes the run cycle as usual, reloading the existing page, or going to another page depending on configuration.

Important points to note

  • Any list of records which can be returned from a Query record can be pushed into the flow as an SObject collection.
  • When specifying a FinishURL output variable in the flow, it must begin with a "/" . E.g., /personalsnapshot instead of personalsnapshot. 

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.