function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Amol ChAmol Ch 

How to scan barcode in salesforce

Overall task is scan the barcode in saledforce.

Suppose my comoputer is connect with barcode scanner machine.
In salesforece  i've a custom object ITEM.  create a visualforce page of this item object and when we  click on new button the page will display.
we can scan the barcode then barcode id should be display on the page in row.
and finally when we click on saved button then record will be saved

How to achieve overall this functionality.

Please suggest.
Nitin SharmaNitin Sharma
Hello Amol,

There is a very good blog written on this by Jitendra. You can refer that to get an idea about barcode scanner using JS :

Below link is also useful for you.

Nitin Sharma
Amol ChAmol Ch
Hi Nitin,

I've seen this blog, but this blog is for saleforce1 i.e on mobile, vf page will display and nobile will scan the barcode image.

I've to use barcode machine not a mobile. so how to configure barcode machine with vf page so it can read.
Doug Y.Doug Y.
Most barcode scanners can be simply used "as-is" on web apps (Visualforce/Lightning) without any special code. The scanner simply emulates keyboard input. You may need to use a little Javascript to "focus" on an input field to receive the value from the scanner. Also you can use JavaScript to submit the value automatically as they are entered if you use a consitent barcode format or have terminators on your barcode (using an asterisk as start/end characters is common).
Might be simple to use one of the scanner mobile apps that can directly create/update data in Salesforce. Checkout "Barcode To Cloud" mobile app available in iOS and Android. Demo video -