# Save the Microphone recording file as an attached on a record

## Overview

This tutorial teaches you how to automatically save and attach microphone recordings made with the [Avonni Microphone](/flow/flow-components/microphone.md) component directly to a record within a Salesforce screen flow.&#x20;

So, let's get started!

{% hint style="info" %}
**Content quick access**

* [Configure the Avonni Microphone](#3.-add-and-configure-the-avonni-input-pen-component)
* [Save the Recording as a file on Salesforce](#4.-create-an-action-component-to-save-the-signature-as-a-file)
* [Add the flow to Salesforce](#5.-add-your-flow-to-your-salesforce)
  {% endhint %}

## Final Outcome

<figure><img src="/files/K98dDRpMECr0UCELkcwc" alt=""><figcaption></figcaption></figure>

## Steps

### 1. Create an input variable

**Create an input variable:** Input variables are essential in this process because they serve as a way to store information passed between different screens in the flow. We create an input variable in this particular flow to store the relevant record information.&#x20;

This allows us to:

* **Link the recording to the correct record:** By storing the record data in the input variable, we ensure that the microphone recording is accurately attached to its intended target within Salesforce.
* **Maintain context throughout the flow:** The input variable lets different screens within the flow access and use the record information as needed, making the process more seamless.

#### Steps to create an input variable

* Create a new Screen Flow
* Click on the "**New Resource**" button
* Resource type => **Variable**
* API name => **RecordID** (or your API Name)
* Data Type => **Text**
* Check "**Available for input**"

<figure><img src="/files/qkfwJH6d8wnmgNjRTjm5" alt="" width="563"><figcaption></figcaption></figure>

### 2. Add a screen component and the Input Pen

* Add a Screen element
* Enter an API name
* Hide Header and Footer (if needed)
* Drag the Avonni Microphone component
* Click the "**Open Component Builder**" button to access all the Microphone component's settings.

<figure><img src="/files/hZMErLr0yiq6X9gsNITZ" alt=""><figcaption></figcaption></figure>

### 3. Configure the Avonni Microphone component to save recordings

You have accessed the component builder at this stage, which is crucial in setting up the Avonni Microphone component.&#x20;

Here's how you can proceed to enable the saved recording as a content document:

* Toggle the "Save as content document" setting.

<figure><img src="/files/3E2aV4sh0IfDMpZC8Vjy" alt=""><figcaption></figcaption></figure>

* Optional - toggle the "**Auto Save Content Document**" to let the Avonni Microphone automatically save the recording as a file on the page where this flow is added.
* Enter a document title used as a document name when the recording is saved on Salesforce.
* Mapped the variable created in [Step 1](#id-1.-create-an-input-variable) to ensure recording files are saved as content documents directly on the record page where the screen flow (containing the Avonni Microphone component) is used.

<figure><img src="/files/p4Yq9Kb1fOlU66Hm2p9F" alt=""><figcaption></figcaption></figure>

### 4. Add your flow to your Salesforce

Once your flow is created, you can add it directly on Salesforce. For example, we will add it to the opportunity record page using App Builder.

<figure><img src="/files/B7p318JiVdfblpTViW9m" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Remember [to pass your current RecordID](/flow/tutorials/tips-and-tricks/how-to-pass-your-current-recordid-in-your-screen-flow.md) in your screen flow when adding your flow to a page using Lightning App Builder.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.avonnicomponents.com/flow/tutorials/components/microphone/save-the-microphone-recording-file-as-an-attached-on-a-record.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
