Click here to Skip to main content
15,885,216 members
Articles / DevOps / Automation

Barcodes, Document Flow and 100 Points Identification on MS Dynamics CRM 2011

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
20 Aug 2012CC (ASA 3U)8 min read 20K   8   2
Barcodes, Document Flow and 100 Points Identification on MS Dynamics CRM 2011

I just finished proof-of-concept for one of our customers. The PoC was a demonstration of capabilities to automate paper document flow based on a custom solution for MS Dynamics CRM 2011. It involves barcodes generation, bulk document printing, scanning of paper documents and automatic recognition of the barcodes and handwritten text within the documents. The solution uses QR Codes to identify the documents.

The most interesting thing is that we can produce some real documents (see photos inside!) and automate process using standard office equipment like printer and fast speed scanner. That was a big part of work and it have been successfully delivered within three weeks. Let's see how I have done this. 

Paper forms with barcodes

Overall Solution Architecture

Let's consider a business process we would like to automate. This process is pretty common for large organizations like banks, insurance or logistics companies. All these organizations have to work with large number of customers who potentially can be dishonest. That is the reason why each bank will ask you about all your personal details and could even ask for certified copies of documents. As we can see in this PoC, the certified copies are too many.

The company provides logistics services for persons all over Australia. So, we have the customers and some of them live in a rural area. Our customers can have an internet connection or can not have. So, some of them may use a company web site to apply for contract. The others will use a paper forms to apply. No matter how customer will apply for contract, we should have the same business process for electronic and paper applications. This documents will contain personal information and that is the reason to store it in a secured storage if we have legal permission to do so.

After customer has applied, the personal information should be validated against 100 points identification. Based on the validation results, the company employee will offer a personified contract conditions for the customer. Later, the customer can call or email company to change the personal information or contract conditions.

Overall solution architecture

Technical Solution for Dynamics CRM

As a basis for interaction with the customers, we may choose Microsoft Dynamics CRM 2011. This system fits the requirements of a wide interaction with the customers, no matter which communication technology they prefer. The system supports direct information storing via web service call. It is useful because we need to integrate it with the existing company web site. Additionally, we can use a mechanism of e-mail queues which I have described in a previous post. This mechanism will be helpful for receiving scanned documents. The last thing is a support for workflow processes which allow us to change status of an application after information verification.

On the other hand, usage of the product could have a potential limitations. For example in this PoC, I have recognized documents using open source libraries with unsafe code. This means that the code must be executed with a full trust. But such scenario is not compatible with a sandbox isolation mode required for Dynamics CRM Online. So, this solution must only use an on-premises installation of the CRM.  

Technical solution based on MS Dynamics CRM 2011

The technical solution involves custom Silverlight controls for displaying barcodes and signatures. It is required because of standard functionality limitations in case you need to display a picture, a list of links or some rich contents. Also, we need two custom plugins. The first will fill barcode information for newly created record. The second will recognize barcode and text from document on receiving of an e-mail in an e-mail queue.

The components of a technical solution

QR Codes Generation

The barcodes could encode some metadata. The metadata in the PoC are used for document type and identifier storing. If the company uses barcodes on all paper forms, then it could be useful for routing scanned documents to the right location and for recognition purposes.

The QR code itself is a text. White space is a space character. Black space is a pseudo graphic character. The only issue when we would like to print a barcode is a font for printing. The font should be monospace without line spacing and with fixed line height. It potentially could be a problem if we are going to print a barcode on an employee computer and it has no proper font. That is why the font should be included in a printing template.

There are a lot of libraries available for code generation. I suggest C# port of ZXing because of simple API and barcode recognition functionality. So, on creating of a record in a system, we could generate a metadata and encode it as a QR code using custom Dynamics CRM plug-in. 

Control to display a barcode

Bulk Document Printing

The records from Dynamics CRM then could be printed using a standard mail merge functionality. A responsible employee will choose documents, for example in status Draft and will initiate a new mail merge.

Selecting records for printing

The mail merge mechanism allows us to use not only letters printing, but also bulk e-mail sending. All we need in our solution is create a new organization mail merge template, which can be used for all bulk printing tasks by different members of a postal team.

Create new mail merge

The set of the records will be directed to Microsoft Word which provides a simple step by step wizard for printing. The good thing about this solution is that we can change individual letters during print preparation.

Mail merge in MS Word

The result is presented in WYSWYG form. All we need is send this document set on printer. In this sample, I will print welcome letters and personalized application forms for three customers. On document printing, we will receive an activity creation dialog which allows us to run a workflow activity in Dynamics CRM. So, we could automatically change status of all printed documents to Printed or Sent.

Preview mail merge in MS Word

The member of a postal team will go to printer and will print the ream.

Log-in on printer

Bulk document printing

Print Document Journey

The printed document then can be folded and embedded in an envelop. In the PoC, we had an envelop with transparent window. So, the address can be printed directly on top of the document. Then, there is no need to print an address on the envelope.

The post will deliver the document to a customer. The customer will fill, sign and post back the application form. The postal team will unpack all incoming messages and scan it using a high speed printer.

Scanning to Email

Almost all modern scanners or multifunctional devices can scan a document and send it to an e-mail. The company service desk team can help to set up a dedicated button on a device to scan the document to CRM’s message queue an e-mail in one click (sorry, tap).

Document scanning

Unfortunately, such customization is not always possible. For example, HP’s equipment I worked with had no such capacity, but RICOH’s had.

Scanning document to e-mail

All scanned document will be delivered to a Dynamics CRM message queue if it is configured properly. You can refer to my previous post about such configuration.

On receiving of a scanned document, we can provide text recognition logic in the form of a second Dynamics CRM plug-in.

The result of the scanning in MS Dynamics CRM 2011 email queue

Automated Recognition of a Scanned Document

The task of a document automatic recognition is not so trivial. The most important part here is an implementation. We need to parse a multipage PDF document. Then to recognize pages with the barcodes, extract document type from metadata and apply document grid according to document type. The main idea behind the document grid is that we should know exactly where to find a separate letter square. Only for a separate letter, we then could apply recognition algorithm which is based on a simple neural network.

During the PoC, I have found that ZXing is not recognizing barcodes if document scanned in resolution less than 200 dpi. It really depends on the size of a QR code. That is why I have attended a research of a proper barcode size and font. I must admit that for production implementation of a system, I would choose a custom font instead of the existing monospace fonts. The important issue with barcode recognition is that if PDF has been produced by virtual printer, then the barcode is presented as a text not as picture. So, my plug-in will have to recognize this. It has been done by custom algorithm.

Testing different fonts for QR Code

When we have a type of the document, it is time to apply a grid. We need to find a document corners, scale a grid and extract images of separate letters. The document corners have been marked with a black boxes of pseudo graphic characters. As a corner detection algorithm, the SUSAN algorithm has been chosen. The implementation by AForge uses an unsafe C# code. That is why the proposed solution is not working in MS Dynamics CRM 2011 Online. A full trust instead of CRM Online plug-in sandbox isolation is required.

The result of a corner detection algorythm

The Result and Following Workflow

We're almost there. Text and signature is recognized. The security around signature can be set up using different forms for security roles.

Now, we can run a workflow to verify the document and then automatically place the information in a standard Account entity which is a final storage.

Extracted signature displayed in a custom Silverlight control

The scanned document can be placed in a security storage. For example, it could be done automatically for Microsoft SharePoint. In PoC, I have integrated the solution with Open Text Document Management system using web service call from the plug-in code.

The result of the recognition

Access from a Web Interface

For use case of an access from web interface, I have demonstrated sample web application based on Silverlight. I also wrote "How to integrate it with Dynamics CRM 2011 using web services" in the previous post.

Web interface for customers

This is it! If you have some questions or you would like to see that solution in Dynamics Marketplace, do not hesitate to contact me. Thank you for reading!

License

This article, along with any associated source code and files, is licensed under The Creative Commons Attribution-Share Alike 3.0 Unported License


Written By
Founder Deploy4Me
Australia Australia
I am a co-founder of Deploy4Me and a Technical Architect. The major interests are software development, software deployment and my family =) Feel free to take a look on what I am doing day by day on Deploy4Me and make you comment to it. Thanks!

Comments and Discussions

 
QuestionBarcode Reader in CRM Pin
Member 968700628-Dec-12 23:26
Member 968700628-Dec-12 23:26 
AnswerRe: Barcode Reader in CRM Pin
Pavel Korsukov28-Dec-12 23:45
Pavel Korsukov28-Dec-12 23:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.