NFC Tag Scanner
Overview
The NFC Tag Scanner component bridges the gap between physical assets and your Salesforce data. It enables your application to read information from and write data to Near Field Communication (NFC) tags directly from a mobile device.
By leveraging the native NFC hardware in most modern smartphones, this component eliminates manual data-entry errors and significantly speeds up field operations. Whether you are tracking inventory, verifying security badges, or logging maintenance on equipment, the NFC Tag Scanner provides a seamless, "tap-and-go" experience for your users.
Use Cases
Asset Tracking: Read NFC tags on equipment to log details in Salesforce.
Inventory Management: Scan tags to update stock or verify items.
Authentication: Read NFC tags for user or device verification.
Event Check-ins: Scan attendee badges for quick registration.
Configuration
Select the NFC Tag Scanner component on the canvas to access properties in the right-hand Properties Panel.
Basic Properties
These control scanner behavior and data handling.
API Name
Text
Unique identifier for the instance.
NFCTagScanner
Type
Select
Mode: read (scan tag data) or write (write data to tag).
read
Open Onload
Boolean
If On, scanner opens automatically when component loads.
Off
Instruction Text
Text
Guidance shown in scanner UI.
"Hold device near NFC tag."
Success Text
Text
Message shown after successful scan or write.
"Tag scanned successfully!"
Best Practice: Use clear Instruction Text to guide users (e.g., device positioning); choose read for most use cases unless writing specific data to tags.
Button Settings
Customize the button that triggers the scanner (if not Open Onload).
Label
Text
Button text.
"Scan NFC Tag"
Variant
Select
Style: e.g., brand, neutral, destructive.
brand
Icon Name
Text (Optional)
Salesforce Lightning Design System (SLDS) icon name.
utility:rfid
Type
Select
Button type: e.g., standard, icon.
standard
Stretch
Boolean
Stretches button to container width.
Off
Disabled
Boolean
Disables button, preventing interaction.
Off
Tip: Use an icon like utility:rfid for clarity; test Stretch for mobile layouts. (Placeholder for screenshot: NFC scanner button UI.)
Interactions Tab
Define actions on successful scan or write.
On Successful Scan
Settings
Trigger on scan/write completion: Access data via $Component.NFCTagScanner.Value (e.g., Update Record, Show Toast, Navigate).
Example 1: Reading NFC Tags for Asset Tracking
This example reads an NFC tag to update an Asset record.
Configure Scanner:
API Name: AssetTagScanner
Type: read
Open Onload: Off
Instruction Text: "Place device near asset NFC tag."
Success Text: "Asset tag read successfully!"
Button Settings:
Label: "Scan Asset Tag"
Variant: brand
Icon Name: utility:rfid
Add Interaction:
On Successful Scan: Update Record (e.g., set Asset SerialNumber__c to $Component.AssetTagScanner.Value); Show Toast "Asset updated."
Result: Users tap the button, scan an NFC tag, and update the Asset record with the tag’s data, with a confirmation toast.
Example 2: Writing Data to NFC Tags
This example writes a record ID to an NFC tag for field use.
Configure Scanner:
API Name: TagWriter
Type: write
Open Onload: Off
Instruction Text: "Hold tag near device to write ID."
Success Text: "ID written to tag!"
Button Settings:
Label: "Write to Tag"
Variant: neutral
Icon Name: utility:edit
Add Interaction:
On Successful Scan: Write {!Record.Id} to tag; Show Toast "Tag updated with record ID."
Key Considerations
NFC Compatibility: Ensure user devices support NFC; test on mobile for best results.
Read vs. Write: Use read for data capture; write for tagging items with IDs or URLs.
Data Output: Scanned data is available as $Component.API_Name.Value; use for updates or flows.
Instruction Clarity: Provide specific guidance (e.g., “Hold 2-3 cm away”) to reduce scan errors.
Interactions: Bind scan data to Variables or Flows for processing (e.g., record updates).
Troubleshooting Common Issues
Scanner Not Opening: Verify device NFC support; check Open Onload or Disabled button.
Scan Fails: Ensure Type matches tag (read/write); test tag proximity and device orientation.
Data Not Captured: Confirm $Component.API_Name.Value binding in interactions; test with static data.
Write Errors: Verify tag is writable; ensure data format matches tag capacity.
Button Unresponsive: Check not Disabled; validate Variant/Type settings.
Summary
The Avonni NFC Tag Scanner component enables seamless NFC tag reading and writing in Salesforce, making it ideal for asset tracking, authentication, and field operations. With customizable UI and interactions, it enhances mobile workflows.
Last updated
Was this helpful?
