Generating Barcodes in CRM 4

Roshan Mehta, 25 June 2010

I have had the privilege to work on a fun task for one of our clients - generating barcodes in CRM. The client requested that a custom CRM report be generated which displays a list of children that belong to a particular class in a church. The report prints out the child’s name, ID number, and a barcode representation of the ID number, so that when it comes time for a class leader to check-in children to the class, they can simply scan the barcode and send the data to CRM.

There were a few challenges I encountered when I first started on this task. Firstly, I was given a barcode scanner, and it was important to know what sort of barcodes the scanner could recognize. There are many different barcode symbols that could be used, but the most common are C39 and C128. I needed to look at an existing report created for our client to understand which code was being used. After a bit of researching, I found out that the C39 symbol requires an asterisk as it's start and stop characters. This allowed me to match the existing barcodes with the C39 pattern, as the start and stop bars are always the same.

The next challenge was to generate the barcode representation of child ID numbers. As mentioned, the C39 symbol requires an asterisk as it's start and stop characters, so an ID of "RM001" would infact need to be coded as "*RM001*" for the scanner to read it correctly. I did some more research and found that the best way to generate the barcode was to use a barcode font, and convert the font to an image which would be created on the custom CRM report on the fly. So the report will read in the child’s ID number from CRM, and automatically generate and display the barcode. The benefit of this approach is that the barcode image doesn't need to be stored anywhere inside CRM, thus removing the risk of the image accidentally being deleted by a CRM user, which would potentially crash the report.

Now, to send the data to CRM to create attendance records, we could use one of two approaches. First, the user could open up a text editor on their PC and scan the barcode ID numbers into that text file. They could then access a custom CRM page where they can upload the text file, and the code behind will automatically create the records in CRM. The second approach would be to allow the users to scan the barcode ID numbers into a text area on a custom CRM page. After scanning each of the barcodes, they would hit a "submit" button which would create the attendance records in CRM.

This was definitely an interesting and challenging task for me to complete. For more information on different barcode symbols used, visit