Set Up an Integration Between BarTender and Dynamics 365 Supply Chain Management
Paul Taylor||
Here we help you understand how to set up BarTender and Dynamics 365 Supply yChain Management Integration.
Paul Taylor
D365 F&O Senior Solution Architect
Follow Me:
Table of Content
SHARE
SHARE
Microsoft Dynamics 365 Supply Chain Management now allows you to set up and print labels using the BarTender labeling solution. BarTender allows you to design your barcode, upload the label to the cloud, and print directly from Dynamics 365.
This short video will help you understand how to set up the integration and includes an overview of mapping in fields and document routing.
Prerequisites
To use the features that are described in this article, you must be running Supply Chain Management version 10.0.34 or later.
Get a Copy of Your Personal Access Token from BarTender Cloud
Before you can access BarTender Cloud through its REST API, you must get a copy of your personal access token from BarTender Cloud. Supply Chain Management will use this token to authenticate with BarTender Cloud. For more information about how to get this token, see BarTender Cloud REST API in the BarTender help center. Be sure to make a note of the token, because you’ll have to enter it later.
Note: Personal access tokens expire after 30 days. You’ll have to enter a new token before the old one expires. You can manually refresh the token to obtain a new one.
Configure Supply Chain Management to Print to Printers Managed by BarTender Cloud
For the scripts that the BarTender Cloud service must run, the BarTender Cloud Actions REST API accepts several formats, including YAML-based and JSON-based action scripts and scripts that use the older BarTender XML (BTXML) format. In this article, the label that’s printed is based on a design that’s saved in your BarTender Cloud account. The article describes how to use the PrintBTWAction action to print the label to a printer that’s accessed through a BarTender Cloud Print Gateway that’s installed on your local network.
Set up an external service definition for printing through the Actions API
Follow these steps to set up an external service definition.
Go to Warehouse Management> Setup > External services > External service definitions.
On the Action Pane, select New to create an external service definition.
Set the following fields for the new service definition:
External service definition– Enter a name for the service definition (for example, BTCloud).
Description– Enter a short description of the service definition (for example, BarTender Cloud).
On the Action Pane, select Save.
On the External service operations FastTab, select Edit operations on the toolbar.
On the External service operations page, on the Action Pane, select New to add an operation for printing variable-based layouts. Then follow these steps for the new record:
On the header, set the following fields:
External service operation– Enter a name for the operation (for example, Actions).
Description– Enter a short description of the operation (for example, Actions API).
On the General FastTab, set the following fields:
HTTP method– Select POST.
Operation timeout– Enter a time-out period for the operation, in milliseconds (for example, 500).
Request body type– Select Raw.
Relative URL– Enter /api/actions.
Note: Cloud Print is a synchronous API. Therefore, it will wait until the label has been printed and will then provide immediate feedback about whether printing was successful. However, because this process can take several seconds, the system might provide a bad user experience for mobile device users. Additionally, the result isn’t currently used. Therefore, we recommend that you set a time-out period of 500 milliseconds. Even though Supply Chain Management stops waiting after this time-out expires, printing will continue in the background.
On the Request HTTP headersFastTab, add a row, and set the following fields for it:
Key– Enter Authorization.
Value– Enter Bearer $auth.secret$. Be sure to enter the value exactly as it appears here.
On the Request bodyFastTab, set the following fields:
Content type– Enter text/yaml.
Body– Enter the content of the request body. Here’s an example.
Important: Paste the body text exactly as it appears here. Indentation is important. Be sure to use four spaces to indent. Don’t use tabs.
On the Action Pane, select Save.
Select the Close button to return to the External service definition
In the list pane, select the record that you were working on at the beginning of this procedure.
On the Label print service FastTab, set the following fields:
Print operation– Leave this field blank.
Variables print operation– Select the name of the operation that you created for printing variable-based layouts (for example, Actions).
Variable label layout template– Enter the content for your variable-based layout template. Here’s an example.
Important: Paste the body text exactly as it appears here. Indentation is important. Be sure to use four spaces to indent. For the NamedDataSources variables, be sure to use six spaces to indent. Don’t use tabs.
Set up an External Service Instance for Printing Through the Actions API
Follow these steps to set up an external service instance for printing through the Actions API.
Go to Warehouse Management > Setup > External services > External service instances.
On the Action Pane, select New to create an external service instance.
Set the following fields for the new service instance:
External service instance– Enter a name for the instance (for example, BTCloud).
Description– Enter a short description of the instance (for example, BTCloud).
External service definition– Select the service definition to use with the instance. The example service definition value that was suggested earlier in this article was BTCloud.
On the General tab, set the following fields:
Base URL– Enter one of the following instance URLs, depending on the region:
Authentication secret– Enter the personal access token that you obtained from BarTender Cloud. You should have made a note of this token earlier when you were preparing for BarTender integration.
Logging level– Select Successes and errors.
Log request bodies– Select Successes and errors.
You can now create label printers and label layouts.
 Note:
When you create label printers on the Label printers page in Supply Chain Management, in the Label print service printer name field, enter the name of the printer as it appears in the Print dialog box in BarTender Cloud, or as it’s retrieved from the Printer API. Use the following format: printer: workstation/printer.
When you create a variable-based label layout on the Label layout page of Supply Chain Management, in the System Variables grid, include a row where the Variable name field is set to LabelFile and the Value field is set to the full path and file name of the label (including any folders, if the label file is stored in a folder). The BarTender Cloud REST API uses a Librarian path, but the beginning of the full Librarian name has already been coded in the variable label template.
When you create a variable-based label layout, the Variable name in the Data variables grid can’t be the same as the Variable name in the System variables