DPID Barcode DataTools Xperido

In my previous article, [Integration] Predictive Address Capture in Dynamics 365 using Kleber by DataTools, I explained how to integrate Dynamics 365 with Kleber Predictive Address Capture Service to retrieve addresses.  One of the parameters we get from that service, apart from the full street address, is the DPID value of the street address.  You may have noticed, when you get your electricity bill or water bill, that there’s a barcode just above the address.


In this article, I will explain what DPID is, the relationship between this barcode and DPID, how we can generate the barcode using JavaScript, and how to print it using Xperido document generation add-on for Dynamics 365.

What is DPID?

DPID stands for Delivery Point IDentifier and is a unique 8 digit number assigned to most street addresses in Australia.

Australia Post upgraded their mail processing network. Part of this project calls for the installation of new Barcode Sorters (BCS) at mail centres to increase sort rates through mechanisation and allow the introduction of deep sorting. These BCS machines will be capable of sorting incoming mail via a barcode read from letters. To implement the new Customer barcoding system for letters, Australia Post has developed the Postal Address File (PAF), which contains 8.8 million physical delivery points in Australia. Australia Post has allocated a unique eight digit Delivery Point Identifier (DPID)to each of these delivery addresses within Australia.

Source: Guide to Printing the 4 State Barcode

Why use DPID Barcodes?

DPID barcodes can be read by Barcode Sorters in Australia Post Mail Centers, Australia Post provides better postage rates for customers, when mailing 1000s of letters every month.  An organisation can save $1000’s when using DPID barcodes instead of only text based addresses.

4 State Barcode

This barcode may include 37 to 67 bars depending on the address.  16 of this bars represents the DPID.  The complete format of the barcode is as below.

Barcode Format

Each bar represents the number 0, 1, 2, or 3 or the corresponding letter F, A, D, or T.  Note: Letter F or H can be used to represent 0.

4 State Barcode Values

For more details of the 4 State barcode, please refer to Guide to Printing the 4 State Barcode.

Generate the barcode using JavaScript

I have extended the dyn365apps_address_validation.html file to include support to process the DPID to generate the value used as the barcode.  The updated file is dyn365apps_address_validation_with_dpid_4state_conversion.html.

Kleber returns the DPID number.  This number is an 8-digit number (i.e. 39549554).  We need to convert this number to something like ATFAFAAFTFADAATFADADAATTADAFATAATDDAT, which represents each state of the barcode as shown above.

There’s a great JavaScript library which implements the encode and decode process of DPID barcodes developed by Bob Mathews.  The library can be found from below link.


Add this library as a web resource and include it in your HTML web resource.

Once we receive the address from Kleber the DPID value is in item.DPID property.  By calling the encode_barcode() function from austpost4.js library you can generate the barcode in FADT format.

Great! So we are done right? Not really.  Now that we have the complete barcode in FADT format, we need to convert it to 0123 format.


DataTools provides a font (DataTools 4State Barcode) which displays FADT barcode states when typing 0123 numbers as shown below.  Once we convert the FADT barcode to 0123 barcode, we can easily display the barcode by simply inserting the 0123 barcode value to a Microsoft Word document and changing the font to DataTools 4State Barcode font.

DataTools 4State Barcode Font

The encode4state() function converts the FADT barcode to 0123 barcode.

Xperido Document Generation with DPID Barcode

Xperido is a document generation and output management add-on for Dynamics 365 (CRM).  For an overview if Xperido and it’s features please check out this video.

Using Xperido Microsoft Word add-in, simply drag and drop the barcode field (in my example, dyn365apps_addressbarcode) to the Microsoft Word template and change the font to DataTools 4State Barcode font.  You can now use the Custom Workflow Activities provided by Xperido to generate letters based on the Word template and send the document to the network printer of the Mail Room.

Thank you for visiting Dyn365Apps.com.

Follow me on Twitter to get the latest news, tips and tricks and more …

Until next time.

[How To] Retrieve DPID and Generate an Australia Post 4-State Barcode using Kleber, Xperido, and JavaScript
Tagged on:                     

Leave a Reply