Developer guide to Custom Shop Floor Insight badges and Printing Shop Floor Insight employee badges outside of Business Central

Skip to main content

Developer guide to Custom Shop Floor Insight badges and Printing Shop Floor Insight employee badges outside of Business Central

You are here:

The intended audience for this guide are developers and technical consultants extending Shop Floor Insight and looking for alternative approaches to printing Shop Floor Insight badges outside of the standard badge reports available inside Shop Floor Insight.

This is not a user guide.  Refer to https://kb.dmsiworks.com/knowledge-base/printing-barcodes-in-shop-floor-insight/ for instructions on how to print badges out of box.

This article presumes a basic working knowledge of Shop Floor Insight and the normal process for printing Shop Floor Insight badges for Shop Floor Employees.

Shop Floor Insight employee badges are normally printed with the Shop Floor Employee Badges report (report 23044111 “SFI Employee Badges”).

Shop Floor Insight employee badges scan a Barcode Entry (table 23044149 “SFI Barcode Entry”), not the Employee No. directly.

You can create your own Business Central reports using the below API to generate the barcode text, or use this information to understand how to print badges externally.

If you are looking for a way to print badges outside of Business Central and are just printing badges from Microsoft Word or Excel consider just using the Shop Floor Employee Badge Report and printing to Excel or Word as an approach.

If you are looking for a way to print badges outside of Business Central and need it automated or do not want to use Excel or Word as an interim you could expose the table table 23044149 “SFI Barcode Entry” via an API page.  The app does not ship with an API page.  The barcode entry record must exist, and that can be done by printing a badge.  As part of a new employee onboarding process it may be necessary to use the “Preview” function to “print” the badge to a PDF to create the barcode entry record as a pre-requisite.

The page “Shop Floor Barcode Entries”, page 23044153 “SFI Barcode Entries” can be used as a human to help visualize and troubleshoot barcodes, showing the MapValue (the integer barcode entry), “Hex Barcode Value”, showing the 8 digit hex portion, and “Full Barcode” which should show the full /RA1B2C3D4% part of the barcode.  Important note is that the “Full Barcode” and “Hex Barcode” are not stored in the database, they are generated dynamically.  Only “MapValue” and “Type” are stored in the database.  You will need to use the “MapValue” (an integer) to generate a barcode if you are in this scenario.

This is also why printing a badge from one company or one environment may not generate the same barcode as one printed from another company, and likely won’t scan; because they will have different barcode entries, thus generate different barcodes.

Barcode value

For an employee badge, the barcode content is:

/RXXXXXXXX%

Where:

  • R = employee barcode type
  • XXXXXXXX = 8-character hexadecimal SFI Barcode Entry.MapID
  • % = suffix from the SFI barcode format

Example:

/R00001F4A%

Lowercase /r...% is also accepted because scanned barcodes are normalized to uppercase.

Creating the barcode from Business Central

Run report 23044111 “SFI Employee Badges”.

The report calls:

Codeunit "SFI Barcode Mgmt".getEmployeeBarcode("SFI Employee"."No.", "SFI Employee"."Badge ID", true)

That creates the required SFI Barcode Entry if it does not already exist, then returns the formatted barcode value.

The RDLC layout may wrap the value in * characters for Code 39 rendering. Those asterisks are barcode-rendering markers, not the value the scanner should send to Shop Floor Insight.   If you’re using something like the Free 3 of 9 font to print Code39 barcodes, then the Free 3 of 9 font uses asterixes at the beginning and end of the barcode text to delineate the start and end of the barcode.  If you are using a different barcode font there could be different prefix and suffix characters to use.

“Badge ID” in this context is the re-print ID, and optionally manually entered and optionally manually changed as an HR process when policies require tracking when reprints are needed. Changing the “Badge ID” will invalidate previous barcode values.  If you are printing this from an external system and don’t have access to this information, check the values in your companies database because quite often they are just 0 (zero).

Creating the barcode programmatically

Use codeunit 23044104 “SFI Barcode Mgmt”.

Public method:

procedure getEmployeeBarcode(pcodEmployeeNo: Code[20]; piBadgeID: Integer; pbIncludeIdentifier: Boolean): Text

Example:

var
    SFIEmployee: Record "SFI Employee";
    BarcodeMgmt: Codeunit "SFI Barcode Mgmt";
    BarcodeText: Text;
begin
    SFIEmployee.Get('EMP001');

    BarcodeText :=
        BarcodeMgmt.getEmployeeBarcode(
            SFIEmployee."No.",
            SFIEmployee."Badge ID",  // If you don't know this, use 0.
            true);

    // BarcodeText example: /R00001F4A%
end;

Use pbIncludeIdentifier = true when generating badge content for scanning.

If you supply pbIncludeIdentifier = false then you would only get the hex value (00001F4A), instead of the full barcode ( /R00001F4A% ).

Creating an image of the barcode for use within a Business Central Report

On-premise Business Central has the option of using fonts like Free 3 of 9 or images.

Newer versions of Business Central cloud can use the Barcode Generator app to help make images, or use the ID Automation Barcode fonts.

codeunit 23044516 “IWX Barcode Generation” with the “Get3of9Barcode” can be used to generate an image into temp blob to allow rendering that image on an RDLC report.

Example pattern:

var
    TempBlob: Codeunit "Temp Blob";
    BarcodeGeneration: Codeunit "IWX Barcode Generation";
    SFIBarcodeMgmt: Codeunit "SFI Barcode Mgmt";
    BarcodeBlob: Record "SFI TempBlob" temporary;
    BarcodeText: Text;
begin
    BarcodeText :=
        SFIBarcodeMgmt.getEmployeeBarcode(
            SFIEmployee."No.",
            SFIEmployee."Badge ID",
            true);

    // Add * only when generating a Code 39 / 3 of 9 barcode image.
    BarcodeGeneration.Get3of9Barcode(
        TempBlob,
        '*' + BarcodeText + '*',
        170,
        20);

    BarcodeBlob.WriteToTempBlob(TempBlob);
end;

Expose BarcodeBlob.Blob as a report dataset column and place it in the RDLC layout as an image.

The important distinction is:

  • The barcode content is the SFI value, such as /R00001F4A%.
  • The image generation may require Code 39 start/stop characters, so the value passed to Get3of9Barcode is wrapped as */R00001F4A%*.
  • The scanner should still return only /R00001F4A%.

Barcode type

The Shop Floor Insight barcode scanning web app does not require a specific barcode symbology, however your barcode reader does.  Whether your barcode is Code 39, Code 128 does not matter to Shop Floor Insight, but it will matter to the barcode reader that you are using.

Code 128, Code 39, QR, or another format can work if the scanner sends the exact text value, for example:

/R00001F4A%

Do not encode only the Employee No. That will scan successfully at the hardware level, but Shop Floor Insight will not resolve it as an employee badge.

Troubleshooting

Check the scanner output first. It must match the SFI barcode content, not just beep successfully.

Using a simple text tool like Notepad, or Notes, or something equivalent for your device open a simple text editor and scan the barcode.

Verify:

  • The scanned text is /RXXXXXXXX%.

Scanning the barcode multiple times should all scan on the same line without line breaks or carriage returns, or other whitespace. There is usually a way to disable the added enter key after every scan, look in the user’s manual for the barcode scanner you have.

  • The payload is 8 hexadecimal characters.
  • The related SFI Barcode Entry exists.
  • The entry was created for the correct Employee No. and Badge ID.
  • The badge printer software is not omitting /, %, or changing case/characters.
Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.
Need help?

Leave A Comment

Table of Contents
Go to Top