# Create a Portal Room in Flow Builder

Rooms can be generated "on the fly" using an Action element in flow builder.
Use cases for creating a room within a flow include:
* **Lead Welcome Room**  Generate a personalized room with relevant brochures based on product intent.
* **Quote Room**  Automatically generate quotes based on self-service product carts. Invite prospects to accept and eSign agreements.
* **Customer Onboarding Room**: Generate rooms that invite new customers to submit a payment methods or complete billing contact information.
* **Invoicing and Billing Room**. Generate rooms to deliver invoices / receive payments.


To create rooms in flows:

* First build and publish a room template using "Room Builder". Note the name or ID of the room (SiteDefinitionData record)
* Drag and drop a flow "Action" onto the flow canvas
* Select the "Room" category
* Select the "Create Room" action

![This will appear if the image fails to load](../../assets/gifs/flows/flow_action_create_room.gif)

This action requires 3 input variables for context:

### Record ID
The `Record ID` is a Salesforce record to be used as the context for the room. Any merge fields in room page text plugins, web forms, or documents will use the fields from this `Record ID`. Any record type is supported. Standard or custom object. The object type must match the room object type defined in the room template. For example, a room created for an Opportunity record ID must use a room template defined to use an Opportunity.

![This will appear if the image fails to load](../../assets/gifs/flows/flow_create_room_type.png)

### Site Definition Data ID or Name
Either the ID or Name values must be populated. This is a reference to a `rooms__SiteDefinitionData__c` record. Upon publishing a portal in Room Builder, a Site Definition Data record is created. Use a GET Record element to retrieve the ID to a Site definition record. Avoid hard coding ID values.

![This will appear if the image fails to load](../../assets/gifs/flows/flow_get_site_def_record.png)

### Generate All Documents (Boolean)
Determines if all documents defined in the published room template are merged with `Record ID`. Default=True.

----
### Output Values

All document and room actions reflect back the input values to the output and additionally provide a boolean `Success` value and a `Message` value. It's generally best practice to capture these 2 values in variables, particularly in screen flows, for use in providing the user feedback.

|Output                              | Values             |Description            
|:----------------------------------|:--------------------------|---------------------|
|`Room ID`                    | Reference to a `rooms__DocumentRoom__c` record | Required in downstream flow actions, such as inviting a contact to a room |
|`Success`                    | True or False | Indicates whether the room creation action was successful. If `False` then details of the error are available in the `Message` output value. |
|`Message`                    | null or String value | Populated with error message details when `Success=False`. |
