Display records as barcodes

In this RayBarcode sample, you can add a Barcode button to the Account or Contact page layout. When this button is clicked on the “Account” record or the “Contact” record, the record information is displayed in the QR code. The QR code data is in vCard format.

This sample uses the GcBarcodeVF component.

Sample configuration

This sample uses the following files:

Visualforce Page

  • AccountBarcodePage
  • ContactBarcodePage

“Account” button or link

  • Barcode

“Contact” button or link

  • Barcode

Apex Class

  • BarcodePageExtension
  • BarcodePageExtensionTest

Samples can be deleted. If you reference or change the sample code directly, deleting the sample may cause the modification to be lost. If you want to reuse the sample, make a copy and use it.

How to use the sample

To make this sample work, add a custom button to the Account or Contact page by following these steps:

  1. Switch the screen of Salesforce to Salesforce Classic.
  2. Go to “Settings > Build > Customize > Business Partner > Page Layout”.
  3. Select “Buttons” in the left pane and drag the “Barcode” button to the “Custom Buttons” area in the “Account Details” section.
  4. The “Barcode” button is displayed below the “custom button”.
  5. Save page layout.

Follow the same steps to add the Barcode button to the Contact page.

Pressing the Barcode button brings up a Visualforce page with the URL and QRCode of the current “Account” or “Contact” object.

The generated barcode can be scanned with a sample for GcBacodeScanner, allowing users to view the same account or contact on their mobile device.

Refer to Read vCard format barcode for the reading method.

Copyright © MESCIUS inc. All rights reserved.