# NFC Scanner

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FoVd4qe61Gi4c9Z1FpyRH%2Fimage%20(50).avif?alt=media&#x26;token=a479ee2c-fffa-43fd-b880-3216d8982e07" alt="" width="375"><figcaption></figcaption></figure>

***

## Key Features & Configuration

* **Type (Dropdown)**:
  * **Read**: Retrieve data stored on an NFC tag.
  * **Write**: Encode data onto an NFC tag.

{% hint style="warning" %}
The Write functionality is, for now, only limited to specific generic fields like name and email.
{% endhint %}

* **Open On Load (Toggle)**:
  * Enable this option to activate the NFC scanner automatically when your screen flow loads.
  * Ideal for flows centered around NFC tag interaction.
* **Instruction Text (Text Area)**:
  * Provide clear guidance to the user on what to do.
  * Example: "Hold your phone near the NFC tag to read its contents."
* **Success Text (Text Area)**:
  * Display a message to confirm a successful scan.
  * Example: "NFC tag read successfully!"
* **Success Interactions (Configurable)**:
  * Define actions to occur upon a successful scan:
    * Save the extracted text to a specific Salesforce object or field.
    * Trigger an interaction from the [interactions available](https://docs.avonnicomponents.com/flow/component-builder/interactions-panel).

***

## Output Variables

The NFC Tag Scanner exposes output variables you can reference in your flow after the screen. To use them, select the screen element in Flow Builder, then the NFC Tag Scanner component, and pick the output variable you need.

### Scanned Values

When users scan one or more NFC tags, these variables capture the scanned data.

| Output variable                 | Type                                | What it returns                                                                                                   |
| ------------------------------- | ----------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| **Value**                       | Record (NfcTagScannerNfcTag)        | The data from the last scanned NFC tag. Use this when scanning a single tag per screen.                           |
| **Value Collection**            | Collection (NfcTagScannerNfcTag\[]) | All scanned NFC tags as a collection. Use this when multiple scans are expected.                                  |
| **Value Collection Serialized** | Text (String)                       | All scanned NFC tags as a JSON string. Useful for passing to an Apex action that processes multiple tags at once. |

> **Example:** A warehouse inventory flow uses the NFC Tag Scanner to read asset tags. After the screen, use **Value** to look up the scanned asset's record in Salesforce and display its details on the next screen.

***

## Step-by-Step Guide

1. **Drag and Drop**: Add the Avonni NFC Tag Scanner component to your mobile screen flow.
2. **Configure Settings**: Choose the type of operation (Read or Write) and customize the instruction and success text.
3. **Design Flow Logic**:
   * **Read Mode:** Use the extracted data to populate fields, display information, or trigger actions within your flow.
   * **Write Mode:** Prepare the data you want to write to the tag and handle the successful write event.

***

## Example Use Case: Retail Product Interaction

Envision a retail environment where NFC tags are affixed to products:

1. **NFC Tags on Products:** Each tag holds information about the product – descriptions, reviews, pricing, etc.
2. **Customer Interaction:** Customers tap their phones to the tags.
3. **Seamless Experience:** The Salesforce app instantly displays the relevant product details, enriching the shopping experience.

***

## Notes

* Ensure that your mobile device and Salesforce app have NFC capabilities enabled.
* For write operations, be mindful of the data format and size supported by the NFC tag.
* The Avonni NFC Tag Scanner prioritizes security and privacy in handling NFC interactions
