All posts

Auto-generate QR Codes in Salesforce, and a cool example use case

QR (“Quick Response”) codes are a simple, powerful way to connect the physical world to your Salesforce data. Whether you’re linking to a form, a webpage…

QR (“Quick Response”) codes are a simple, powerful way to connect the physical world to your Salesforce data. Whether you’re linking to a form, a webpage, or triggering a process via URL, generating QR codes directly from Salesforce allows you to:

  • Eliminate manual steps
  • Create scalable systems
  • Let business users take action without technical help

By combining formula fields, QR code APIs, and Salesforce automation, you can generate and store QR codes on any record—automatically.

This opens up a wide range of use cases:

  • Instant check-in forms for in-person events
  • Feedback forms linked to service cases
  • Asset tracking for inventory
  • Lead capture at booths or conferences

Let’s walk through one example in detail: tracking attendance at free community events.

Example Use Case: Event Attendance Tracking with a QR Code Check-In

Imagine this:

You’re running free events open to the public, like a job fair or community service day. There’s no registration fee, but you want to know who actually attended. Instead of asking staff to track people with clipboards, you display a QR code at the entrance.

Attendees scan it, fill in a quick form, and are logged in Salesforce as Campaign Members—either as new Contacts or updates to existing ones.

This workflow is 100% manageable by non-technical users and scalable for future events.

Overview of the End-to-End Workflow

Let’s break down the full process into 4 stages:

Step 1: Create a Salesforce Campaign

This is the event record in Salesforce.

  • A staff member creates a new Campaign like “Fall Community Meetup.”
  • This Campaign gets a unique Salesforce ID (e.g., 7015g000000kABC).
  • This ID is used to track all check-ins related to that specific event.

Step 2: Auto-Generate a QR Code from the Campaign

Once the Campaign is created, a Salesforce formula field constructs a URL that includes the Campaign ID as a URL parameter:

https://yourformtool.com/checkin?campaignId=7015g000000kABC

This URL is then embedded into a dynamic QR code using a public API like bwip-js:

IMAGE(
  "https://bwipjs-api.metafloor.com/?bcid=qrcode&text=" &
  "https://yourformtool.com/checkin?campaignId=" & Id,
  "QR Code"
)

An automation (like a Flow or Apex trigger) can then:

  • Generate this QR code formula URL,
  • Make a callout to fetch the QR code as an image (PNG),
  • Save it as a ContentDocument attached to the Campaign.

Now anyone can print, download, or embed the QR code in event flyers, digital signage, or email reminders.

Step 3: Display the QR Code and Collect Form Responses

You print the QR code and place it at the event entrance. When someone scans it, they land on a check-in form. The form should:

  • Capture the Campaign ID from a URL parameter.
  • Ask for First Name, Last Name, Email, and maybe a question like “What brings you here?”

There are two main paths you can take for processing the form data:

Step 4A: Use a Form Tool with Native Salesforce Integration (e.g. FormAssembly)

With a native tool like FormAssembly or Fillout, you can:

  • Pass the campaignId as a hidden field
  • Use built-in Salesforce mappings to:
    • Find or create a Contact
    • Link them to the Campaign via a CampaignMember record

This is the most seamless option if you already use one of these tools.

(Note: FormAssembly is more robust and includes the ability to query Salesforce data and pre-fill form fields with it, and it starts at $83/mo. Fillout is a simpler 1-direction tool and has a great free offering that would work for this use case.)

Step 4B: Use a Free Form Tool + Webhook + Streamscript

For orgs on a budget, you can still build this without middleware:

  • Use a free form tool like Tally.so (which supports webhooks)
  • Configure it to POST data to Salesforce via webhook upon submission

Then, use the free Salesforce AppExchange package Streamscript to:

  • Accept webhook payloads
  • Parse JSON inside a Flow
  • Check if a Contact already exists by email
  • Create the Contact if needed
  • Create a CampaignMember record using the campaignId from the URL

🪄 All declarative. No external automation platform required.

Summary: What’s Happening Under the Hood

StepWhat HappensTools
1. Campaign createdBusiness user creates a Campaign in SalesforceSalesforce Campaign
2. QR code generatedFormula + Flow or Apex builds check-in URL and QR image, saves it as a fileFormula Field + QR API + ContentDocument
3. QR scannedUser lands on form with campaignId in URLTally/FormAssembly/etc.
4. Form submittedData goes to SalesforceNative integration or Streamscript webhook
5. Contact + CampaignMember createdFlow either creates or updates Contact and links to CampaignAutolaunched Flow

Why This Is So Useful

  • Business-friendly: Anyone can create a Campaign and print its QR code. That’s it.
  • Zero manual entry: Attendees check in themselves.
  • Clean data: Existing Contacts updated, new ones added properly.
  • Free or low-cost tooling: Works with both enterprise-grade and totally free tools.
  • Reusable architecture: Works for future events without rebuilding. Especially straightforward if there’s only 1 form for all your events; but even if you needed multiple versions of forms that could still be easily supported.

Final Thoughts

This is more than just a cool QR trick—it’s a repeatable operations framework. Once you’ve built it, you can use it to:

  • Track attendance
  • Segment follow-up emails
  • Trigger post-event surveys
  • Measure engagement by campaign