Skip to main content

Salesforce and QR server integration for QR code generation in Salesforce

QR codes are very helpful in emails or business cards and often we get requirements in mobile application or a mail send to lead from salesforce to contain these QR code .

There has been lot of talks and debates on usability of this technology .Infact google has deprecated the API. Nevertheless some customers still prefer this technology and we often find QR codes in business cards ,front page of books ,Quotes and so on.

So this blog post demonstrates how to form the QR code in salesforce with the help of the qrserver

Please make sure to read the terms and conditions of the before using the QR code API for commercial  purpose .

There is already a good blog post from one of the MVP on this and hence it was very simple task for me to read and follow.Here is the link to the blog and it was nicely written.

The above blog used google chart API but since google have deprecated this API ,i had to look for the other websites providing me the API.

There were couple of good websites .


In this blog i will be describing how to use formula field to generate the QR code using the API .The procedure remains same as we use with google chart API as demonstrated in the blog.

My assumptions are i have employee custom object and i have a formula field named QRCode and remote site settings has been configured for the .

so here is the formula using IMAGE function of the salesforce on how to bring the QR code from the

IMAGE(''+ Name ,'hello',50,50)

Make sure to specify URL in small caps in image tag.For the readability purpose i have made all caps and in actual those are in small caps

data field consists of the content that will be displayed once the QR code is scanned by the reader.

Please note how the variable Name is used .Actually its  a merge field used from the formula editor and hence for each record this is dynamically populated .

50-Height of the image in pixel

50-Width of the image in pixel.

'hello '-string that will be displayed in case image fails to renders 

The QR image can be easily scanned with QR readers.There are number of readers available for mobile and the desktop.

I downloaded a QR code reader for my desktop from the URL below and works great .

From the screen the reader automatically scans the QR code and decodes the Text in it .

A small hint incase you need this image on the visualforce page here is the code to help

Hope the above information is helpful for people looking for sample approach on QR code generation in salesforce.


Popular posts from this blog

Invoking Apex Callout From Process Builder

Process builder is GA in Spring 15 and one of the queries I came across was around how to invoke apex callouts from Process builder .

Before process builder came we had two common approaches of calling webservice 

1)We have outbound messages as one of the Actions for workflows.This works if other party implements the WSDL that is generated once Outbound messaging is defined with appropriate end point .

2)Most of times future method invoked through triggers allowed to do apex callouts and invoke external web service provided the future method is annotated with @future(callout=true).This provides lot of flexibility and one of the best approaches .

3)Flow triggers was in BETA and this was also one of the ways we could invoke callouts provided the Flow implements process plugin .To understand in detail how to implement process plugin refer to the below example

The purpose of this blogpost is to demonstrate the new possibility of invoking apex callout through Process Builder 

I tried initi…

Opening Modal Using Lightning Component Framework of SFDC

One of my friend from India threw a challenge .The challenge was to open a modal by using latest and greatest lightning components framework and modals design from SLDS .For the love of community I thought of sharing the entire code base that I did .

So here we start ..

Business Use Case - Need a handy SalesLeader board component that can be used to display the Sales revenue generated by each sales rep for current year in the order of decreasing total revenue .On click of the tile ,we will show detail opportunity list aggregating the revenue .

The component can be dragged in lightning design experience or in App builder lightning Page .

Video Demonstration-

SalesLeaderBoard from Mohith Kumar Shrivastava on Vimeo.

Frameworks Used -
Lightning Design Systems (SLDS) for CSSLightning Component Framework for client side logicApex aura enabled class for backend logicApproach
The component hierarchy is very important to imagine or mindmap before we dig deeper- SalesLeaderMain

Writing Test Classes For Apex Rest Service

I came across a question in a developer community on how to write Unit Test Classes for the Rest API service for POST HTTP calls

Unit Test Classes for REST API following link is very useful and inspired by this jeff had an article on his blog on how to write the test method for same .

Here is the Jeff Blog Link Test Class for REST API(Good reference for GET Rest Services)

In one of my previous blog post i demonstrated how to use native parsing technique for Rest api for User Defined Type
I wrote the Test class for the same and this post is helpful for all those searching for how to write test classes for apex rest service annotated with POST Call
Here is the Rest Service Class for which i attempted the test class
@RestResource(urlMapping='/DemoUrl/*') global with sharing class MyRestResourcedemo { global class RequestWrapper{ public Account acct; public Contact[] cons; } global class ResponseWrapper { public String StatusCode; …