Dynamic QR Codes for Dynamics CRM

Standard

For some reason, Live Writer is failing to publish to Blogger which makes writing blogs tricky. Combined with the travel I am doing this Christmas means it will be tricky for me to knock out my usual three blogs a month. Either way have a great Christmas break 😉

I recently had a demo where I needed to generate QR Codes for CRM records and then make the codes available for printing. The scenario was for events where the QR code would appear on the invitee’s email and then the recipient could print it and be scanned at the event to confirm their attendance. This was something I had never done before and I was not sure it could be done. Generating QR codes is easy but dynamically generating a unique QR code for every Contact record in CRM and make it available for marketing is something else. Thankfully a bit of research (and a tiny bit of code later) and I was good to go.

What to Code

QR Codes can code practically any text you like. In this case I needed to code the web address for a Contact record. Every record in CRM has a unique web address which you can see when you click the ‘Email a Link’ button.









Generating the Code

The trick to generating the QR Code is the Google Charts API. In short, you construct the right URL and Google renders it as a QR code on the fly. For example, here is the QR code for my blog:

The API for QR codes is deprecated i.e. no longer supported by Google, but Google says it will remain active in the foreseeable future.

Now all we have to do is bring the CRM URL and the QR Code generator together, put the result in a field then add it to an email and we are set.

Bringing it Home

The first step is to access the unique web address of the record. To do this I use a workflow to populate a field on the Contact form with the record’s URL on creation.

The unique web address of the record is a special field accessible in workflows. Just look for ‘Record URL’.




The next step is to construct the web address and put it into the QR Code field so that when it is clicked, or added to an email, it will display the QR code.

In principle, this could also be done with a workflow but when I tried it would not work. It turns out the ‘&’ characters in the CRM URL for the Contact record confuses the Google API and we need to ‘encode’ the URL. This means replacing the ‘&’ with ‘%26’. Unfortunately I cannot do this with workflows or calculated fields so I needed to get some code written to do this and populate the QR Code field. Thanks to Steven Zhang for his flawless code (I have not got permission to provide the code but if you bribe your local dev they should be able to replicate the code without too much difficulty).

The end result is two populated fields on the Contact record which get populated on the Contact’s creation: one is a URL to the record and the other generates a QR code which, when scanned, also goes to the record.










In the case of our demo, we used ClickDimensions which allows you to add the web address of an image to an email template to be rendered on delivery, which was perfect.

Conclusions

The ability to generate QR codes on the fly for CRM records is very powerful. In this case I am using it for Contact records for events, but it could also be used for products for picking slips, for event flyers or to link with Adxstudio portals to direct non-CRM users to forms or sites so they can interact through the CRM portal.

Even outside of Dynamics CRM, the Google API for generating QR codes is a great tool to have in the toolkit.

Advertisements

3 thoughts on “Dynamic QR Codes for Dynamics CRM

  1. leontribe

    This is true, it is an authentication issue. It raised its head about 9 months ago when Google turned it off but a deal was done between Microsoft and Google to keep it going because of the outcry but it seems Google has finally pulled the pin.

    With the Blogger editor being awful and it being very easy to move to WordPress, which I had already dabbled with, it was a relatively easy decision. Hopefully my readership will come along for the ride as well 🙂

    Thank you for the link to the Open Live Writer. I did not know about this so it is good to know. I assume it is a ‘maintenance build’ i.e. maintaining the existing functionality, rather than providing new functionality so I’ll probably move to it when I upgrade my Surface.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s