Pages

Wednesday, February 4, 2015

Salesforce QR Code

QR code is getting popular as now most people carrying smart phone, we can install QR code reader for free. We often see QR code in many places, from print advertisement, shop ad., event registration, ticket, and etc. In QR Code, we can store many information inside the square code and it is readable easily by QR code reader.

However, as of now Spring '15 release, Salesforce still do not have with feature with QR code out of the box, there is an idea in IdeaExchange for QR code, but the point is still very low, currently only 30 points, it need to get 2500 points to get into Product Team Review stage, so vote it here now.

But, we can use 3rd party support to get QR code generated in Salesforce for multiple purposes. In this blog, we will use Google API to generate QR code, which is free.

You just need to create a simple formula field with return type = Text.

1. Search in Google
Use case: to search Account Name using Google without have to type the Account Name.
IMAGE('https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl=https://www.google.com/search?q='+ Name, 'Scan the QR code to search in Google')

QR code generated will merge Account Name as parameter into Google search URL. User with QR Code reader can just scan the code and get Google search for the Account Name. You can use the same functionality to open other static website, such as Account website.


2. Add Contact to mobile phone
Since QR code is available in mobile phone, it is handy to add Contact to mobile phone.

Sample Google API with generate QR Code to add contact to mobile phone
https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl=MECARD:N:Yu Johan;ADR:100 Orchard Road, Singapore, 200100;TEL:+6565881234;EMAIL:johan@domain.com;

Let us try to understand each parameter:
  • chs : image size -- chs=<width>x<height>
  • cht : qr -- specifies a QR code
  • chl : <data>, we use MECARD in here
MeCard
You can think of MeCard as a light version of vCard. Essentially, a single line of text contains all the meta data and appropriate information for populating an address book. Info such as name, address, telephone, email, URL and more. 

The meCard format is far less popular than the vCard and the MeCard can only be used in QR-codes, and on mobile devices. The meCard specification was created by Docomo, Japan’s largest mobile service provider. According to the Domoco website, the meCard fields listed below are supported on the greatest number of mobile devices:
  • Name
  • Telephone 
  • eMail 
  • Birthday 
  • Address
Back to sample above, we can easily merge Salesforce Contact fields into above URL and add into IMAGE() formula:

IMAGE('https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl=MECARD:N:' +  FirstName + ' ' + LastName  +';ADR:'+ MailingStreet +',' + MailingCity + ',' +  MailingState  + ',' + MailingCountry + ',' + MailingPostalCode + ';TEL:'+  MobilePhone  +';EMAIL:' +   Email  + ';', 'Scan the QR code to create contact in your mobile')

As of now, Google Chart Tools: Infographics has been deprecated, but you can use the same formula with other QR code generator, such as: Visualead or goQR.me





1 comment:

  1. Alternate approach without google API key - https://salesforcecodes.blogspot.com/2020/09/displaying-barcode-in-salesforce-lightning.html

    ReplyDelete

Page-level ad