Create record in Salesforce using QR code scanner using mobile application


At times there are business needs for mobile apps to scan QR codes and store the results in Salesforce. Couple of common scenarios where this is useful is:

  1. Scan the QR code and create a Lead or Contact in Salesforce. This is useful when registering users to events.
  2. Scan information about a product and update the inventory information.
This document describes a scenario where the value of QR code was stored in Salesforce using a mobile app.

Mobile Application to perform QR Code scanning

  1. The app scans a QR code and returns data of QR code using a plugin.
  2. Jsforce api creates records of specified objects on Salesforce using data returned by the QR code scanner.

Client Requirements:

The clients requirement was to create a record in Salesforce by scanning QR code using a mobile application. QR code consists of data which is required to create records in salesforce. Salesforce object can be Contact or Leads or any custom objects.


  • Login using salesforce credentials to your app.


  • Scan this QR code which contains information as shown in a screenshot below.


  • Scan this QR code using a mobile application.


  • App will create a new record in Salesforce with the value returned by QR code scanner

Technical Approach:

In QR code Scanner App we use connected app and Jsforce plugin

  • Connected App
    A connected app is an application that connect to over identity and data API’s. Connected Apps use the standard OAuth 2.0 protocol to authenticate, provide Single Sign-On, and acquire access tokens for use with Salesforce APIs.
    Connected App Name - QR Code Scanner

  • Jsforce plugin
    JSforce (f.k.a. Node-Salesforce) is a isomorphic JavaScript Library utilizing Salesforce's API: It works both in browser and with Node.js.It capsulates the access to various APIs provided by Salesforce in asynchronous JavaScript function calls.Unlike other Salesforce API libraries, it is intended to give integrated interface both server-side and client-side apps, so you don't have to rewrite similar logics with different libraries only for running in different environment.
    1. Backbone.js
    2. Forcetk.mobilesdk.js
    3. Forcetk.ui.js
    4. Underscore.js
    An overview of these libraries is given bellow:
  • is responsible for responding to connected apps.
  • Forcetk.ui.js is responsible to show salesforce login ui with all login constraints
  • Backbone.js and Underscore.js consist of some definition of functions which are used in jsforce library.


The app was able to create the records in Salesforce from a mobile app using the QR code scanner.