Blogs Developer Home

Generate QR Code for Any Salesforce Object

QR code (Quick Response Code) is the trademark for a type of matrix barcode (or two-dimensional barcode) first designed for the automotive industry in Japan.A barcode is an optical label that is read by machines and contains information about the item to which it is attached.
There are four standardized encoding modes that a QR code uses to efficiently store data.

  • Numeric
  • Alphanumeric
  • Byte/Binary
  • Kanji

Extensions may also be used.
QR Code in Salesforce:- 
The Meaning of QR code remains the same even in salesforce.

  1.   Create QR code for any object in Salesforce.
  2.   It will be auto-generated for all records in Salesforce.
  3.   Scanning the particular QR code will take you to the record it is associated to.

You can pick any object, Let say we are using  Account Object for implementing this functionality.
Steps to follow:

  1. Click on Setup (on Top right of Salesforce Org )
  2. Then go to Quick Find box . Go to Customize then Accounts and then Fields.
  3. Click on New Button to create a new Custom Field.
  4.  Select Formula field type .
  5. Give the Field name as “QR Code” and then select formula return type as Text.
  6. Then paste the following code in formula area: IMAGE(‘×200&cht=qr&chl=’&Id ,’Scan QR code to open record in mobile.’)
  7. Now you click on  Next ,Next and the Click on Save .
  8. Now  you can use any QR Code Scanner to  verify the results . 

Explanation of above code: 

  • IMAGE(image_url, alternate_text [, height, width]) : is a function to show image with giving URL.
  • chs=200×200&cht=qr&chl=’& Id
    • 1 : Is Google Chart API
    • 2 chs: Height and width of QR Code
    • 3 cht: Chart Type. We need to put qr for QR code
    • 4 chl: QR Code will generate this text. (In our example I am putting URL of record)

Note: Please put your domain Url instead of
Now Save your formula field and open any record. You can see a QR Code on record.
QR Code scanner App available on Android Phone.

  1. Open the App and Scan your Code.
  2. It will show something like this.
  1. On Scanning QR code, it will redirect you to  below screen :
  1. Click on the generated link on the bottom of the screen. It will redirect to record.

I hope, this blog would help you understand QR Code.

Similar Posts