Updating Salesforce using barcode from a mobile application

Introduction:

Mobile Application based on phonegap is used to perform two major functions:

  • It Scans a barcode and if there exists a record with that barcode in an object then it updates some fields of that object.
  • It Scans a barcode and if there exists no record with that barcode then it creates a record for it.

Client Requirements:

To Scan a barcode and if there exists a record with that barcode in an object then update Donation Amount (fieldname of that object) and if there exists no record with that barcode then it shows an alert “can not update Donation Amount”.

Summary

  • Login using salesforce credentials to your app.

    Custom Object Connector image2

  • Click on Scan Barcode button

    Custom Object Connector image2

  • Further Barcode scanner will open , you can now scan a particular barcode.

    Custom Object Connector image2

  • If there exists a Contact record related to barcode which is scanned a pop window will open where you can update donation amount.

    Custom Object Connector image2

  • Further you can logout of this app using Logout Button

    Custom Object Connector image2

Technical Approach:

In Barcode Scanner App we use connected app and Jsforce plugin

  • Connected App
    A connected app is an application that connect to Salesforce.com 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 - Barcode 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
  • Login and Logout
    Allow the user to logout of the app , and then login as a different user without any Problems

Conclusion:

We were able to achieve a solution where we are able to match the records in salesforce from mobile app using the Barcode as a unique property and did update or creation based on that. Customer was happy and got the solution to their requirement.