# Generate a QR Code from a record field

## Overview

This guide provides an in-depth exploration of utilizing the [QR Code component](../../../flow-components/qr-code) within Salesforce. This component seamlessly transforms any field from a Salesforce record into a QR Code. Whether you want to represent textual information, URLs, or other data types, this component enables the easy creation of QR Codes within your Salesforce environment, offering a versatile way to share and access information quickly and efficiently.&#x20;

By following this tutorial, you’ll gain insights into configuring and implementing this component to meet your specific needs and enhance how you interact with data in Salesforce.

## Steps

### 1. Create your screen flow

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FxF3NhGFNefYKsguHpwi1%2F2023-05-23_11-00-44.png?alt=media&#x26;token=e8f59644-b330-4799-89ac-9c6c5ab0dd84" alt=""><figcaption></figcaption></figure>

### 2. Create the record ID variable

The Record ID variable serves as a unique identifier for any record in Salesforce. It's a critical piece that allows for precise record manipulation within our flow, ensuring that we interact with the correct record at any point in our process.

Here's how to do it:

{% @arcade/embed flowId="KlG912NS430OtpzSUOXz" url="https://app.arcade.software/share/KlG912NS430OtpzSUOXz" %}

### 3. Create the Get Records collection

A Get Records Collection, essentially, instructs our flow to retrieve a specific set of records from our Salesforce object. By creating this collection, we allow the flow to gather the relevant data needed for our operations based on specified conditions - in this case, the current Record ID.

Utilizing the Record ID variable, we've previously created, we can set a condition that lets the Get Records element fetch the necessary data associated with the current Record ID. This ensures we're working with accurate and relevant data corresponding to the specific record.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2Fdd1IT9uHKvjXdqRalzqg%2F2023-05-23_10-53-26.png?alt=media&#x26;token=ca8b02e5-0daa-4ad6-b3e1-d7795e8dd28f" alt=""><figcaption></figcaption></figure>

### 4. Add your screen flow

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FYMsww9Ak6BOh41aP3wgq%2F2023-05-23_10-57-17.png?alt=media&#x26;token=3d8e8903-fccb-49c3-8b8f-b69419dc631c" alt=""><figcaption></figcaption></figure>

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FeW7ZCvYljY2A1WuzpiT8%2F2023-05-23_10-58-14.png?alt=media&#x26;token=c1534324-2dbc-426a-9ce5-0aa9e7c55f14" alt=""><figcaption><p>Adding the Avonni QR Code component</p></figcaption></figure>

#### Mapping the current record ID value

Assigning the QR Code value involves designating a specific record field whose data will be used to create the QR Code. We can establish a link between the Avonni QR Code component and the chosen record field by leveraging the mapped attribute.

The mapped attribute essentially acts as a bridge, linking the QR Code generator to the relevant record field. When the current record ID is processed, the corresponding record field value is automatically used to generate a QR Code.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FRqq2d1lEUX6sYOeikbbv%2F2023-05-23_10-59-45%20(1).gif?alt=media&#x26;token=0cae2850-d70b-4eac-aef9-c1f50e806426" alt=""><figcaption><p>Configuring the value of the QR Code to fetch data from a field.</p></figcaption></figure>

### 5. Adding your flow on a record page

In setting up our flow within Salesforce, adding the flow to our record page via App Builder is a pivotal step. In this process, it's crucial to ensure that we select the correct flow we intend to display on the record page.

Another critical step is checking the box labeled "**pass record ID into the variable**". Enabling this option allows the record page to communicate with the flow, transferring the Record ID of the current record directly into our flow's Record ID variable. This ensures that our flow works with the correct record based on the page the user is viewing.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FAa6V1k2oMFMyr0S1Ipgu%2F2023-05-23_11-11-10.png?alt=media&#x26;token=f8c411ed-a76b-42b4-b454-103127793561" alt=""><figcaption></figcaption></figure>
