You are on page 1of 152

Table of Contents

Module 1: MICROSOFT DYNAMICS AX 2012 R2 FOR RETAIL IN


BRICK AND MORTAR STORES- DEVELOPMENT AND
CUSTOMIZATION
Lesson 1: Course Objectives .......................................................................................................................1-1

Module 2: INTRODUCTION TO POINT OF SALE (POS) OVERVIEW


Lesson 1: Introduction to POS ...................................................................................................................2-2

Module 3: POS EXTENSIBILITY TECHNICAL OVERVIEW


Lesson 1: Extend Point of Sale ...................................................................................................................3-2
Lesson 2: Retail POS Plug-ins ....................................................................................................................3-2
Lesson 3: Commerce Data Exchange: Real-time Service Calls ......................................................3-5

Module 4: POS FRAMEWORK


Lesson 1: POS Architecture Overview.....................................................................................................4-2

Module 5: DEVELOPMENT ENVIRONMENT REQUIREMENTS


Lesson 1: Development Environment Requirements........................................................................5-2

Module 6: TECHNICAL BACKGROUND


Lesson 1: Technical knowledge required to customize POS .........................................................6-2

Module 7: LOCALIZATION INFORMATION


Lesson 1: POS Localization .........................................................................................................................7-2

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization
Module 8: EXTENSIBILITY BEST PRACTICES
Lesson 1: Solution Approach .....................................................................................................................8-2
Lesson 2: Reference .......................................................................................................................................8-5

Module 9: LOGON EXTENSIBILITY SAMPLE AND HOW-TO


Lesson 1: Logon Extensibility .....................................................................................................................9-2

Module 10: POS THEMES


Lesson 1: POS Skins .................................................................................................................................... 10-2

Module 11: USER-INTERFACE EXTENSIBILITY SAMPLE AND


HOW-TO
Lesson 1: How to Modify a Form in Microsoft Dynamics AX 2012 R2 POS .......................... 11-2

Module 12: TRIGGER EXTENSIBILITY SAMPLE AND HOW-TO


Lesson 1: How to Modify the Trigger Project ................................................................................... 12-2

Module 13: SERVICES EXTENSIBILITY SAMPLE AND HOW-TO


Lesson 1: How to Modify the Services Project ................................................................................. 13-2

Module 14: BLANK OPERATION EXTENSIBILITY


Lesson 1: Blank Operation on the Retail POS Register ................................................................. 14-2

Module 15: CUSTOM FIELDS ON POS LAYOUTS


Lesson 1: Custom Fields on the POS Layout ..................................................................................... 15-2

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Table of Contents
Module 16: REAL-TIME SERVICES EXTENSIBILITY SAMPLE AND
HOW-TO
Lesson 1: Extending the RetailTransactionServiceEx Class .......................................................... 16-2

Module 17: POS PAYMENT CONNECTOR


Lesson 1: Payment Connector ................................................................................................................ 17-2

Module 18: POS DATABASE TOOL EXTENSIBILITY FOR STORE


AND OFFLINE DATABASE
Lesson 1: CreateDatabase Service ......................................................................................................... 18-2

Module 19: EXTENSIBILITY TESTING CONSIDERATIONS


Lesson 1: Testing ......................................................................................................................................... 19-2
Lesson 2: Challenges .................................................................................................................................. 19-5
Lesson 3: Testing Considerations .......................................................................................................... 19-6

Module 20: EXTENSIBILITY DEPLOYMENT AND HOTFIX UPDATE


CONSIDERATIONS
Lesson 1: Deployment Planning ............................................................................................................ 20-2
Lesson 2: Deploy POS Customizations ................................................................................................ 20-3
Lesson 3: Merge Any Existing Code Changes with POS and Redeploy .................................. 20-4
Lesson 4: Install Updates to Non-Database Retail Components............................................... 20-4
Lesson 5: Install Updates to Store Databases by Using the Retail Database Utility ........... 20-5
Lesson 6: Install Update to CDX: Real-Time Service....................................................................... 20-5

Module 21: EXTENSIBILITY LAB MANUAL

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

MICROSOFT DYNAMICS AX 2012 R2 FOR RETAIL IN


BRICK AND MORTAR STORES- DEVELOPMENT AND
CUSTOMIZATION
Course Objectives
The main objectives of the Microsoft Dynamics for Retail in Brick and Mortar
Stores course is to understand the development and customization that is
explained in the following topics:

Introduction to Point of Sale (POS) Overview

POS extensibility technical overview

POS Framework

Development environment requirements

Extensibility Interface Definition Triggers and Services

Technical background

Localization Information

Extensibility Best practices

Logon Extensibility Sample and How-to

POS Themes

User-interface Extensibility Sample and How-to

Trigger Extensibility Sample and How-to

Services Extensibility Sample and How-to

Blank Operation Extensibility

Custom Field on POS Layouts

Real-time services Extensibility Sample and How-to

Device Integration (Hydra, EFTPOS)

POS Database Tool Extensibility For Store and Offline Database

Extensibility testing considerations

Extensibility deployment considerations

Deployment of ongoing hotfixes for Customized POS for version(s)


and code maintenance

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

1-1

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

Module Review
Student Objectives

1-2

1.

What do you expect to learn by participating in this course?

2.

List three main objectives.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

MODULE 2: INTRODUCTION TO POINT OF SALE


(POS) OVERVIEW
Module Overview
Microsoft Dynamics AX for Retail POS is the point of sale (POS) program for
Microsoft Dynamics AX. POS tasks are performed by using a POS register. The
graphical user interface (UI) is easy to use and can be set up to meet the
requirements of many industries, such as grocery, fashion and specialty retailers.

Objectives
The main objective of this module is to discuss the Microsoft Dynamics POS
Overview.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

2- 1

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

Introduction to POS
Microsoft Dynamics AX for Retail POS
Microsoft Dynamics AX Retail POS is a solution that brings speed, power,
flexibility, dependability, and ease of use to the point-of-sale. Retail POS has a
dynamic interface that can be configured and customized for your type of
business and store procedures. Additionally, Retail POS can work offline. This helps
make sure that your stores remain fully operational during network interruptions.
All data is automatically updated when the connection is restored.

FIGURE 2.1: RETAIL SOLUTION SYSTEM OVERVIEW

2-2

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 2: Introduction to Point of Sale (POS) Overview


Microsoft Dynamics Retail Components:
Microsoft Dynamics POS interacts with the following retail components to perform
end to end operations:

Commerce Data Exchange: Synch service

Commerce Data Exchange: Real time service

Store and offline database

Microsoft Dynamics AX for Retail Synch Service:


Synch service is the integrated service that periodically sends data between the
head office and store database. Communications that use synch service are
managed through distribution locations and Retail Scheduler in Retail
Headquarters (HQ).

Microsoft Dynamics AX for Retail Real time Service:


Together with synch service and Retail Scheduler, real-time service completes the
communications mechanism of Microsoft Dynamics AX for Retail by providing
real-time, synchronous communication between POS registers and Microsoft
Dynamics AX. It can be used to authenticate cashier logon credentials, send
loyalty requests, and exchange up-to-the-minute physical inventory information
between the head office and the stores, and more.

Store Database:
Each store must have its own database, and a single database is used for multiple
registers. This helps make sure that the same master data is available to all POS
registers in the store.

Offline Database:
You can also create an offline databases on POS computers. An offline database
helps make sure that the stores operations can continue even if the connection to
the shared database server is lost. If the connection to the shared database server
is lost, the POS computers switch to offline databases. The shared database and
the offline databases are kept in sync by using Microsoft Sync framework.
The store and the offline database can be set up by using the create database
utility.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

2-3

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization
Microsoft Dynamics POS Operations
Microsoft Dynamics AX for Retail POS is the point of sale (POS) program for Retail.
You can use Retail POS to perform the following tasks:

Process sales

Operate the cash drawer

Scan bar codes

Print customer receipts

Calculate the sales total

Calculate tax

Calculate the change that is due back from the amount that is paid

Issue product refunds

Suspend transactions

Process customer loyalty transactions

Issue credit memos

Issue gift cards

Scan bar codes

Receive payments

Print receipts

Create and track customer orders

Process debit cards and credit cards

Check inventory, plus many more.

The following operations cannot be performed when the store database is offline:

2-4

Print an X report

Print a Z report

Close a shift

Blind-close a shift

View blind-closed shifts

Suspend a shift, plus more

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 2: Introduction to Point of Sale (POS) Overview


The following operations cannot be performed when the connectivity to HQ is not
working (CDX: Real time service connection down):

Inventory Lookup

Gift Card Operations

Loyalty Operations

Customer order Operations, plus more

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

2-5

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

Module Review
Module Review and Takeaways

About Microsoft Dynamics AX 2012 POS

Real time service

Synch service

POS Operations

Store and Offline database.

Test Your Knowledge


Test your knowledge with the following questions.

2-6

1.

What is the CDX: Synch service used for?

2.

What is the CDX Real-time service used for?

3.

What is the difference between the CDX synch service and the CDX Real-time
service?

4.

Describe any POS Operations.

5.

Can an offline database be shared across multiple terminals?

6.

Describe any two operations that cannot be performed when the POS store
database is offline.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 2: Introduction to Point of Sale (POS) Overview

Test Your Knowledge Solutions


MODEL ANSWER:
1.

Synch service is the integrated service that periodically sends data


between the head office, stores, and individual Retail POS terminals.

2.

Real-time service completes the communications mechanism of


Microsoft Dynamics AX for Retail by providing real-time, synchronous
communication.

3.

Synch service is used for synching the data between HQ and POS.
Real time service is used for providing real-time information form the
HQ.

4.

Receive payment operation. This operation can be used to receive


payment from the customer in POS through different tender types
that are configured in HQ.

5.

No. Only the store database can be shared across multiple terminals.

6.

Close shift and print Z-report.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

2-7

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

2-8

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

MODULE 3: POS EXTENSIBILITY TECHNICAL


OVERVIEW
Module Overview
This module discusses the Microsoft Dynamics AX 2012 POS extensibility and its
operations.

Objectives
The main objective of this module is to help you understand how to customize
and extend the Microsoft Dynamics AX 2012 POS. After you complete this course,
you will know how to customize and extend POS.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

3- 1

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

Extend Point of Sale


Microsoft Dynamics AX for Retail POS is a fully customizable point of sale (POS)
component of Microsoft Dynamics AX 2012 for Retail. You can use Retail POS to
process sales, operate the cash drawer, and scan bar codes or print customer
receipts, among other business tasks.

Lesson Objectives
How to customize or extend Microsoft Dynamics AX 2012 POS.

POS Extension
To customize business logic in Retail POS, you must install the Retail Software
Development Kit (SDK). The SDK is included with Microsoft Dynamics AX 2012. It
contains two folders:

POS Plug-ins Contains code that you use to extend and customize
Retail POS. For more information about how to install Retail POS
Plug-ins, refer to Install Retail SDK.

Commerce Runtime Contains services that you use to extend and


customize the online store for Microsoft Dynamics AX 2012 for Retail.
The details of this are not explained in this course.

Retail POS Plug-ins


This topic talks about the Retail POS Plug-ins and how to use the Plug-ins to
extend or customize the business logic, user interface UI and new operations in
POS.

Lesson Objectives
After you complete this lesson, you will know how to customize or extend the
Microsoft Dynamics AX 2012 POS.

About POS Plug-ins


Retail POS Plug-ins contains set of services and application triggers. Most of the
functionality in Retail POS is implemented by using services. For example, you use
the Customer service for tracking, adding or deleting customers from the Retail
POS register.

3-2

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 3: POS Extensibility Technical Overview


These services are a collection of the .NET Framework assemblies that implement
public interfaces. Refer to the POS Extensibility Interface Definition course
document for more information.
Retail POS loads the services at run time and invokes their functionality through
these interfaces. Because Retail POS Plug-ins is included with the C# source code
for these assemblies, you can customize or replace services and triggers to extend
features in Retail POS, such as calculating taxes.
By default, Retail POS Plug-ins is installed in the following directory:
1.

C:\Users\...\Documents\Retail SDK\POS Plug-ins\

The folder contains two Visual Studio solutionsone for services and the other for
triggers. Triggers are used to insert custom code before or after Retail POS
operations, such as issuing a gift certificate, a customer add, a clear, or a payment,
and more. For example: Before you issue a gift card, if you want to do a validation
such as whether the customer is eligible to issue a gift card, you can perform the
validation here.
The Microsoft.Dynamics.Retail.Pos.Contracts.dll assembly exposes all the public
interfaces to be used for implementing extensions and customizations to the
following Retail POS functionality:

Operations

Services

Triggers

Commerce Data Exchange: Real-time Service

FIGURE 3.1: POS PLUG-INS

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

3-3

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization
Operations
An operation is an activity that occurs in Retail POS. Operations can be a single
step or a multi-step. Refer to the POS Framework course document for more
information.

Services
Services include one or more operations and implement a single, unique interface.
You can make partial modifications to an existing service and continue to use the
remaining functionality. Or, you can replace the complete service assembly with
your own custom code. For more information about how to implement services,
refer to How to modify a Form at http://technet.microsoft.com/enus/library/jj937978.aspx

Interface for Services


Features in the Retail POS are services that interact with the program through
interfaces. Services include one or more operations and implement a single,
unique interface. Each service implement an interface. The developer can make
partial or full modifications to the services project. Microsoft Dynamics AX 2012
ships with a collection of core services that can be customized or replaced using
Retail POS Plug-ins. For descriptions of all the services interfaces that are available
in Retail POS, please refer Interfaces for Services"

Triggers
Triggers are events raised by Retail POS that enable you to insert custom code
before or after operations. There are two types of triggers:

Pre-triggers

Post-triggers

Please refer the POS Framework course document for more information.

3-4

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 3: POS Extensibility Technical Overview


Interface for Triggers
Triggers are events that are raised by Retail POS that you can use to insert custom
code before or after operations. Similar to services, triggers also implement
unique interfaces. The developer can use triggers to perform pre-validations and
post validations. Each trigger interface has set of methods that can be extended
by the developers for customization. Pre-triggers provide an additional layer of
verification and can return false if the operation should be canceled. Post-triggers
let you respond to an operation after it is finished. Triggers can be extended in the
same manner as services. For descriptions of all the triggers interfaces that are
available in Retail POS, refer to Interfaces for triggers.

Commerce Data Exchange: Real-time Service Calls


Retail POS can make real-time calls to Microsoft Dynamics AX 2012 using the
Commerce Data Exchange: Real-time Service. This service provides real-time,
synchronous communication between Microsoft Dynamics AX 2012 and individual
Retail POS terminals.

Lesson Objectives
This lesson helps you understand the real time service functionality of Microsoft
Dynamics AX 2012 POS.

Real-time Service Calls


Retail POS uses real-time service calls to start Retail POS functionality, such as
Issue Gift Card or Create Customer. You can create custom, real-time service
functionality in Retail Headquarters and call it from Retail POS.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

3-5

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

Module Review
Module Review and Takeaways

Understand how to extend Retail POS

Retail POS Plug-ins Operations

Services, Triggers and Real-time services

Use Visual Studio 2010 Ultimate or a more recent version to


customize Microsoft Dynamics AX 2012 POS.

To customize the Real-time service use in HQ, use the Morphx


development suite.

Tools

Test Your Knowledge


Test your knowledge with the following questions.

3-6

1.

What is Retail POS Plug-ins?

2.

When do you use POS Plug-ins?

3.

What are the two main components of Retail POS Plug-ins?

4.

When should Real-time services be used?

5.

What is the difference between services and triggers?

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 3: POS Extensibility Technical Overview

Test Your Knowledge Solutions


MODEL ANSWER:
1.

Retail POS Plug-ins contain sets of services and application triggers to


extend POS

2.

To extend or customize POS

3.

Services and Triggers

4.

Any real-time, synchronous communication between Microsoft


Dynamics AX 2012 and individual Retail POS terminals like Gift card,
loyalty

5.

Services contains the core business logic whereas triggers are events
raised by Retail POS that enable you to insert custom code before or
after operations.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

3-7

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

3-8

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

MODULE 4: POS FRAMEWORK


Module Overview
This module explains the POS technical architecture. This module also provides
information about the different components in the POS framework

Objectives
The main objective of this module is to help understand the POS technical
framework, its components and other retail components it uses.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

4-1

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

POS Architecture Overview


This course provides information about the different POS architecture
components that include the following:

POS Core

CDX: Real time service and Synch service

POS Database

POS Architecture
The POS Architecture consists of the POS Core components.

FIGURE 4.1: POS ARCHITECTURE CORE COMPONENTS

4-2

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 4: POS Framework


POS Core
The POS core is the focal point of POS that interacts between the POS user
interface (UI), and the POS data layer, services and triggers.
The key components of the POS core include the following:

Operations

Transaction

SystemFramework

SystemeSettings

DataAccess (Data Layer)

Contracts

The components in the POS core are not extensible.

FIGURE 4.2: POS COMPONENTS

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

4-3

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization
Operations
An operation is an activity that occurs in Retail POS. Operations can be a single
step, or a multi-step. For example, Add Item adds a sales line to the current
transaction. The Customer add operation presents a form for a cashier to enter
customer information. After data is entered and the form is closed, the customer
information is sent to Retail Headquarters.
Microsoft Dynamics AX 2012 includes a collection of core operations that cannot
be modified. However, you can create new functionality by using the
BlankOperations. You can use Blank Operations to extend Microsoft Dynamics AX
for Retail POS by adding custom logic to the Retail POS register buttons. In the
Retail POS register, you can add the blank operation button to the POS layout and
link it with your custom operations.

Transaction
The transaction dll contains the core transaction classes and Interfaces that are
used in standard and extended components. Most POS operations will have the
POS transaction passed as parameters that are during the operation.

System Framework:
This dll contains the transaction service. This service is a direct start to
Headquarters (HQ).

System Settings:
This dll contains all the settings that are related to connection details, operator
details, terminal details, store details, transaction service details, hardware profile,
functionality profile and other Application details that can be used while
extending POS.

Data Access:
This dll acts as a data layer between the application and the POS database. It
provides a set of interfaces and, or classes that are used in standard operations,
services and triggers.

Contracts
The contracts dll contains interfaces that are used across multiple core and
extended components of Point of Sale. When POS Plugins are installed, this dll is
included as part of plugin code. When you extend a service and, or triggers, add
this dll to the project. Also, dll should be deployed to the POS folder, after you
extend.

4-4

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 4: POS Framework


POS Extensibility
POS Extensibility points give the user the option to extend the POS for custom
requirements. The key components include the following:

Services Forms
Although third-party components from the DevExpress libraries were used to
build the POS application, you do not have to be familiar with how to set up a
development environment by using the DevExpress libraries.
All Windows forms in POS are developed by using the "DXExperience Winforms"
product that is created by DevExpress. However, you must have a DevExpress
license to modify the design-time visual changes to existing forms. Although you
are not required to have DevExpress tools to create new POS forms, it is
recommended that you use them to have a consistent appearance with the rest of
the product.
Microsoft Dynamics AX 2012 R2 POS introduces a new way to customize forms by
using the Interaction service. Multiple developers can customize one or more
forms in one service. If there are multiple customizations, the Interaction service
loads only the first customization it finds for a form. The following list of forms
uses this new pattern and their implementations are included in the
InteractionDefaults service.

ExtendedLogOnForm

ExtendedLogOnScanForm

frmBarcodeSelect

frmDimensions

frmInput

frmPayCash

frmPayCurrency

frmPayCustomerAccount

frmReturnTransaction

LogbookForm

LogOnForm

ManagerAccessForm

RegisterTimeForm

ViewTimeClockEntriesForm

ProductDetailsForm

ProductInformationForm

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

4-5

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization
Skins:
By using the DevExpress SkinEditor program, you can change the appearance of
Microsoft Dynamics AX for Retail POS registers by creating new Retail POS skins.
To create new Retail POS skins, you must obtain a license from DevExpress. Retail
POS uses DXExperience Winforms that is created by DevExpress. You can develop
your own forms without having to use DevExpress. However, it is recommended
that you use these to maintain a consistent appearance.

CDX: Real-time service


Retail POS can make real-time calls to Microsoft Dynamics AX 2012 by using the
Commerce Data Exchange: Real-time Service. This service provides real-time,
synchronous communication between Microsoft Dynamics AX 2012 and individual
Retail POS registers.
Retail POS uses real-time service calls to provide some Retail POS functionality,
such as Issue Gift Card or Create Customer. You can create custom, real-time
service functionality in Retail Headquarters and call it from Retail POS.
In Retail R2 the Real-time Service changed from a Windows Service to an IIS Web
Service. It acts as a traffic handler between the POS and Headquarters to share
real-time information. All actual logic is written in X++ code that is hosted in the
Application Object Server (AOS) and accessed through the .Net Business
Connector. This change in architecture means that the installation and
configuration includes many changes. Refer to the installation guide to set up the
new real time service.

4-6

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 4: POS Framework

FIGURE 4.3: REAL-TIME SERVICE

CDX: Synch Service (Retail Store Connect)


Commerce Data Exchange: Synch Service is a service that shares data among retail
components. These components include the head office, stores, and individual
point of sale (POS) terminals. When you install Synch Service, the Retail Salt Utility
and Retail Scheduler are also installed. The Retail Salt Utility provides additional
encryption for the passwords and credentials that are associated with the Retail
system. Retail Scheduler is used to manage the distribution of data between the
head office and the stores

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

4-7

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

FIGURE 4.4: CDX SYNCH SERVICE

POS Database
This lesson explains about the POS store database and offline database.

Lesson Objectives

Store Database

Offline Database

Retail Offline Synch Service

Store Database
Store database is a central database that is inside a store. Typically, a store
database is hosted on a shared server that is connected to all the POS terminals in
the store. Multiple POS computers in a store can connect to the same store
database.
Store database data is synched with HQ by using the Synch service.

4-8

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 4: POS Framework


Offline Database:
Together with the store database, you can also create the offline database on the
POS terminal. This helps make sure that the store operation can continue even if
the connection to the shared database (store database) is lost.

Retail Offline Synch Service:


The shared database and the offline databases are kept in sync by Microsoft
Dynamics AX for Retail Offline Sync Service. This Windows service will run in the
POS computer and synch the data between the shared database and the offline
database.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

4-9

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

Module Review
Module Review and Takeaways

POS Architecture

POS Core

CDX : Real time service and Synch service

POS Database

Test Your Knowledge


Test your knowledge with the following questions.

4 - 10

1.

What are the main components of the POS architecture?

2.

What is the POS Core?

3.

How is the Transaction library used?

4.

How is the CDX Synch service used?

5.

Which service synchs the data between the store database and the offline
database?

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 4: POS Framework

Test Your Knowledge Solutions


MODEL ANSWER:

POS Core, CDX Real-time service, CDX Synch service and store
database

The POS core is the focal point of the POS that interacts between the
POS UI and the POS data layer.

The dll transaction contains the core transaction classes and the
Interfaces that are used in standard and extended components. Most
POS operations will have the POS transaction passed as parameters,
which are used during the operation.

Retail offline synch service.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

4 - 11

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

4 - 12

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

MODULE 5: DEVELOPMENT ENVIRONMENT


REQUIREMENTS
Module Overview
This module will explain the development environment requirements.

Objectives

Explain the development environment requirements.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

5-1

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

Development Environment Requirements


System Requirements
The development environment that is shown the following table assumes that all
the components are installed in single box. If you are installing each component
on different boxes, then refer to the AX2012 System Requirements document for
detailed information.
Components
Operating System

Requirements
Windows Server 2012 Standard Edition or
Datacenter
Edition
Windows Server 2008 R2 Standard Edition,
Enterprise Edition, Web Edition, or Datacenter
Edition
Windows Server 2008 Standard Edition, Enterprise
Edition, Web Edition, or Datacenter Edition, with
Service Pack 2 (Only 64-bit versions of Windows
Server 2008 are supported)

Processor

Intel Pentium/Celeron family or a compatible


Pentium III Xeon or larger processor. We
recommend a processor speed of 1.1 GHz or larger.
Important:
Microsoft Dynamics AX is not supported on Itanium
64-bit processors.

5- 2

RAM

We recommend 4 GB or more of RAM for server


computers.

Hard disk space

Minimum 80 GB

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 5: Development Environment Requirements


Software Requirements
Components

Requirements

Application Object
Server (AOS)

NET Framework 4.0, with the hotfix


from Knowledge Base article 2390372,
(http://support.microsoft.com/kb/239
0372).
SQL Server 2008 Native Client

Notes
Install SQL Server Native
Client on the AOS server
if the AOS server is
separate from the
database server.
You must install the SQL
Server 2008 version of the
Native Client, even if you
are using SQL
Server 2012.

AX Client

.NET Framework 4.0

Debugger

No additional software requirements

Visual Studio and Tools

Windows PowerShell 2.0


Visual Studio 2010, Professional
Edition, Premium Edition,
Ultimate Edition, or Team Edition,
with Service Pack 1

.NET Business Connector

Visual Studio 2012 can be


installed side by side with
Visual Studio 2010.
However, Visual Studio
2012 is not supported for
Microsoft Dynamics AX
development.

No additional software requirements

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

5-3

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization
Components

Requirements

Database

Microsoft SQL Server 2012, Standard


Edition,
Enterprise Edition, or Business
Intelligence Edition. Service Pack 1
(http://www.microsoft.com/enus/dow
nload/details.aspx?id=35575) is
supported. However, it is not required.
or
SQL Server 2008 R2, Standard Edition,
Enterprise Edition, or Datacenter
Edition. Service Pack 1
(http://www.microsoft.com/download
/en/details.aspx?id=26727) and
Service Pack 2
(http://www.microsoft.com/enus/dow
nload/details.aspx?id=30437) are
supported.
Service Pack 1 is required if you are
installing
Reporting Services extensions.
or
SQL Server 2008, Standard Edition or
Enterprise Edition, with Service Pack 1.
Service Pack 3 is supported. However,
it is not required.

The Retail module in


Microsoft Dynamics AX,
Retail POS, Commerce
Data Exchange: Synch
Service and Real-time
service, Retail Store
Database Utility and
Retail SDK

5- 4

Notes
By default, SQL Server
2012 is supported with
Microsoft Dynamics AX
2012 R2. To use SQL
Server 2012 with an
earlier version of
Microsoft Dynamics AX
2012, you must install
Microsoft Dynamics AX
hotfix 2680186
(https://mbs2.microsoft.c
om/Knowledgebase/KBDi
splay.aspx?scid=kb;enus;2680186).
Only 64-bit versions of
SQL Server are supported.
For the minimum
hardware requirements
for SQL Server, see
http://www.microsoft.com
/sql/default.mspx.
In a production
environment, we
recommend that you
install the latest
cumulative update for the
version of SQL Server that
you are using.

Application Object Server (AOS), OS


and other components are mentioned
earlier in this document.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

MODULE 6: TECHNICAL BACKGROUND


Module Overview
This module provides information about the knowledge required to customize
POS

Objectives

Understand the knowledge required to customize the POS

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

6-1

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

Technical knowledge required to customize POS


In this lesson we will understand the technical knowledge required for the
developer to customize POS.

Microsoft .Net framework


The developer should have basic knowledge on .net framework and advanced
knowledge on C#. Retail POS is developed using C#, and thus knowledge in c# is
mandatory.

POS Functionality
The developer should have a basic understanding of POS processes and
functionality to extend or customize POS. Please refer POS functional training
document (AX2012 ENUS_RTL) for more information.

SQL Server 2008 or higher version


Basic knowledge on SQL Server is required to customize POS because we will be
creating or modifying the tables, stored procedures for POS

Retail HQ Setup and Configuration


It is preferable to have knowledge on HQ Retail setup (Distribution schedule) and
configuration like CDX sync and real time services to quickly diagnose the
problem and issues.

Knowledge on X++
Basic knowledge on x++ is required to customize or extend CDX Real-time
service.

6-2

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

MODULE 7: LOCALIZATION INFORMATION


Module Overview
This module provides information about how to localize Point of Sale (POS) by
changing the POS labels and strings.

Objectives

Explain the requirements that are used to change POS labels and
strings.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

7-1

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

POS Localization
Localization is the process of adapting software to meet country-specific laws or
regulations. Microsoft localizes Microsoft Dynamics AX to include features and
functionality designed to address specific tax, accounting or financial reporting
requirements for various countries.

Languages
Translation is the process of adapting software or documentation to meet
language requirements for a particular country. For any given language, Microsoft
may translate some, all or none of the user interface (UI) and documentation for
Microsoft Dynamics AX.
To set up POS in specific language, go the respective Retail Channel and change
the retail channel language. We can change the language in AX Retail by
navigating to Retail->Common->Retail channels->Retail stores->Language

FIGURE 7.1: SET UP POS IN SPECIFIC LANGUAGE


A very common requirement to localize the POS in Dynamics AX for Retail is to
change the wording of the strings and labels in the product. In this lesson we will
learn how to do that.

7-2

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 7: Localization Information


POS Labels and Strings
Nearly every string that is used in the product resides in the
POSResources.resources.dll file in the POS folder. The English (en-us) version of
this file is in the root folder, and then we have one for all of the localized
translations: fi\POSResources.resources.dll, fr\POSResources.resources.dll, etc.
When the POS application needs a string, it checks in the following places in the
order listed:

The dbo.RetailLanguageText table in the POS database

The POSResources.resources.dll file for the language currently being


used

When a string is found, it gets cached for the remainder of the POS instance
lifetime. As a developer, this means that you cannot manipulate the strings at
runtime any changes that are made to the table do not get reflected until the
next time the app is started.

Change/Add POS Labels and strings


To change the text of an existing label or string, we need to populate three
columns in the RETAILLANGAUGETEXT table: LANGUAGEID, TEXTID, and TEXT
(the remaining columns are deprecated and are no longer used in the product).
LANGUAGEID and TEXT are the language Id in AX and the actual text to be
displayed in POS. But to get the TEXTID we can follow the below step:
Modify the POS shortcut and append a -tr as a command-line argument, POS
will run in a special developer mode where each string and label is prepended
with the TEXTID. This will allow you to find exactly which strings and labels match
up with which ID.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

7-3

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

FIGURE 7.2: RETAIL POS PROPERTIES

7-4

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 7: Localization Information

FIGURE 7.3: OPERATOR ID


Find the ID of the string that you want to change and then add the new text to
the RetailLanguageText table with ID you of the string you want to change.
Since there is no form for adding strings to the RetailLanguageText table, we will
populate the values directly in the AOT. Open a new developer workspace and
navigate to Data Dictionary > Tables > RetailLanguageText. Right-click and select
Open. Create a new records by populating the languageID, Text and textID fields:

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

7-5

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

FIGURE 7.4: EMPLOYEE ID


Also use the RETAILLANGUAGETEXT table for any strings that you create from
scratch. The Blank Operation sample plug-in uses 50700 as a starting number; that
number through 50700-50999 are currently un-used. We can use the number
between these series for our custom strings. Please make sure that TextID is not
conflicting with strings from other developers or possibly by future versions of the
product.
Once youve added your strings to the table, you can use this method to grab
strings from the table.
myString = ApplicationLocalizer.Language.Translate(28);

7-6

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 7: Localization Information

Module Review
Module Review and Takeaways

Understand how to change POS Strings and labels

Test Your Knowledge


Test your knowledge with the following questions.
1.

What is the command parameter used to launch POS in special mode which
displays the label ids?

2.

In which table the POS custom strings and labels are stored?

3.

Which library stores all the POS labels and string resources?

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

7-7

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

Test Your Knowledge Solutions


MODEL ANSWER:

7-8

1.

-tr

2.

RETAILLANGUAGETEXT table

3.

POSResources.resources.dll

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

MODULE 8: EXTENSIBILITY BEST PRACTICES


Module Overview
AX Retail POS (Point of Sales) is a .Net solution which is available as part of AX
Retail installation. The SDK will be available for the implementation team to
customize further as per the specific customers requirement. With the SDK we can
customize the POS services and Triggers only.
This document provides general guidelines on how to customize the Retail
solution and overall solution approach for the POS Retail part. As this is on .Net,
.Net specific coding guidelines will be applicable by default.

Objectives

Provide best practices and guidelines/standards for Retail POS


customization.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

8-1

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

Solution Approach
There are two primary approaches for POS customization. These are:
1.

Greenfield Development

2.

Brownfield Development

Greenfield Development
The Greenfield approach for adding customizations on POS is to implement the
customization in default interfaces provided by the plugins. Then Replace the
OOB DLL provided by the Retail POS installation with the custom DLL.
For example, in order to customize the Sales Order service, load the services
solution form the Retail POS SDK(By default the SDK path will be
C:\Users\...\Documents\Retail SDK\POS Plug-ins\) folder and extend it by adding
the new classes and methods within the same SalesOrder project.

Brownfield Development
In brownfield development style, partial classes are used to keep customized
code separate from the OOB plugins code.
The advantages of using partial classes is that

Customized code resides in a separate file rather than existing plugin


code file which help in code merging during the hotfix deployment
and we will have the clear separation of code between the
customization and OOB Retail SDK.

In future, if there are any upgrades or hot fixes release, developers


can make those changes to OOB Plugin code by comparing it with
the new updates in code, while customized code can be demarked
clearly

During operations lifecycle of the system, you can more easily find if
the issue belongs to OOB Plugin code or it is customized code

In all Retail implementation of AX, each customer will have a specific requirement
for authorizing credit card payments. To do that, developer will have to modify
the EFT class provided in the EFT Project. To incorporate this change, follow the
below steps:

8-2

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 8: Extensibility Best Practices


Create a new C# file
Taking the Credit card Payment Processing scenario, create a new file called
_EFT.cs in the EFT project, as shown in the figure below.

Modify the class declaration and namespace


In the new class file created,

Rename the class declaration to partial class; in the current scenario, it


will be public partial class EFT : IEFT

Rename the namespace to match the OOB class, which in the current
scenario, will be namespace EFT

Copy namespaces from OOB class, to the new class file

Implement new methods or comment the existing methods in the


OOB class and implement it as required in the new partial class.

In the OOB file class,

If the class is not partial class, rename the class declaration to partial;
in the current scenario, it will be public partial class EFT: IEFT

Source Code Control


Source code control gives you the benefits of versioning, tracking and reverting
back to earlier versions. If you are part of a team customizing POS, automated
source code control provides a significant advantage. When many people work
together to create, support, and update source code files for POS, the
coordination of files and updates is a complex process. Team Foundation Server
(TFS) provides stable, easy-to-use source code management to keep the team's
developers in sync with each other's changes.

Solution Configuration
When setting the solution in TFS, the delivery team must configure the complete
Services and Triggers solution in TFS. While configuring the Services or Triggers
solution, proper version of the AX Retail POS version must be chosen (AX 2012
R2)
From the Services or Triggers solution, the project specific solution must be
configured as a branch from the main application. By doing this, we are keeping
the original source code as is in the main solution and keep only the project
specific code in the branch

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

8-3

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization
The projects which we are not used for customization from the Retail SDK can be
removed from the TFS branch. In this way, the delivery team will be focused only
on the items they will be modifying and delivering to the customer. The solution
available in the branch should comply with the coding standards of .Net like
FxCop, StyleCop, VS Code analysis and Code metric standards. For detailed
information on these standards please refer the link in the reference section.

TFS for Version control .NET solution


Daily builds
Use Release version of the dlls for deploying to testing, Staging and Production
environments

Unit Testing
It is usually conducted by the development team. This testing is to verify and
validate that the individual units of source code are fit for use.
Considerations:

The ability of the system to properly process erroneous transactions

systems or components pass data and control correctly to one


another

Using Test Driven Development (TDD) developer can write unit test cases for
solution before actually writing that code. By writing a test and then writing the
code to make that test pass developers have a much better idea of what the goal
and purpose of the code is. Also, a TDD comprehensive suite of unit tests can be
run at any time to provide feedback that the software is still working. It improves
the quality of code and ensures total code coverage of custom code. The
developer can use Visual T#, NUnit, MS Test, xUnit or any other viable unit test
framework for TDD driven unit testing. For detailed information on the unit
testing please refer the link in the reference section

8-4

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 8: Extensibility Best Practices

Reference
Partial Classes and Methods (C# Programming Guide) http://msdn.microsoft.com/en-us/library/wa80x488(v=VS.100).aspx
AX for Retail: A Better Sample for EFT plug-in (Credit Card processing)
http://blogs.msdn.com/b/axsupport/archive/2012/01/14/ax-for-retail-a-bettersample-for-eft-plug-in-credit-card-processing.aspx
C# coding guidelines
http://msdn.microsoft.com/en-US/library/vstudio/ms229042(v=vs.100).aspx
Guidelines for Test-Driven Development
http://msdn.microsoft.com/en-us/library/aa730844(VS.80).aspx
Test Driven Development
http://msdn.microsoft.com/en-us/library/aa730844(v=vs.80).aspx
Visual Studio 2010: Test Driven Development
http://msdn.microsoft.com/en-us/gg454254
FxCop
http://msdn.microsoft.com/en-US/library/bb429476(v=vs.80).aspx
Code analysis
http://msdn.microsoft.com/en-us/library/3z0aeatx.aspx
StyleCop
http://archive.msdn.microsoft.com/sourceanalysis
Code Metrics:
http://msdn.microsoft.com/en-us/library/bb385914.aspx

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

8-5

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

Module Review
Best Practice:
1.

Follow C# coding guidelines

2.

Follow FxCop and StyleCop standards

3.

Enable static code analysis in VS

4.

Follow the below code metrics:

Maintainability Index per method > 20

Cyclomatic Complexity per method <= 20

Class Coupling per class or type <= 20

Depth Of Inheritance per class or type <= 6

Lines of code per method <= 40

Test Your Knowledge


Test your knowledge with the following questions.

8-6

1.

What is Greenfield development

2.

What is Brownfield development

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 8: Extensibility Best Practices

Test Your Knowledge Solutions


MODEL ANSWER:
1.

In Greenfield approach all the customization is done in new classes or


projects and added as reference

2.

In Brownfield approach customizations are done in partial classes.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

8-7

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

8-8

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

MODULE 9: LOGON EXTENSIBILITY SAMPLE AND


HOW-TO
Module Overview
In this module we will learn how to extend POS Logon functionality and support
for using any external device for logon like Biometric devices.

Objectives

Understand how to extend POS Logon functionality.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

9-1

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

Logon Extensibility
This lesson provides brief information about the POS Logon extensibility feature
using some external devices or any other mediums.

Extending Logon by using Biometric devices:


Dynamics AX Retail 2012 R2 POS allows ISVs to use biometric device for logon.
Following interface must be implemented by POS plugin:

FIGURE 9.1: BIOMETRIC DEVICE FOR LOGON INTERFACE


Following the typical sequence for POS logon follow and call into the biometric
plugin

9-2

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 9: Logon Extensibility Sample and How-To

FIGURE 9.2: SEQUENCE FOR BIOMETRIC PLUGIN


Steps to implement biometric logon:
1.

Implement following interface in a new POS logon plugin assembly.


Microsoft.Dynamics.Retail.Pos.Contracts.Services.IBiometricDevice

2.

Copy the POS plugin and related assemblies to the \Extensibility


directory under your POS directory.

3.

Launch POS

4.

Go to Extended Log on operation and click assign on any staff to


enroll for biometric logon.

The sample provides information on how to extend the logon functionality in POS
to use Biometric devices.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

9- 3

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization
Biometric Plugin
The below code provides the abstract for implementing the Biometric plugin. We
can extend this code to implement biometric login in POS.
public sealed class BiometricPlugin : IBiometricDevice
{
public event BiometricDeviceDataEventHandler DataReceived;
public event BiometricDeviceStatusEventHandler StatusUpdate;
public void Load()
{
// Init the biometric device
}
public void Unload()
{
// Cleanup
}
public string DeviceName
{
get { return string.Empty; }
}
public string DeviceDescription
{
get { return string.Empty; }
}
public bool IsActive
{
get { return true; }
}
public void BeginEnrollCapture()
{
// Create worker thread for enroll capture and return
}
public void BeginVerifyCapture()
{
// Create worker thread for verify capture and return
}
public void EndCapture()
{
// close the thread.
}

9-4

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 9: Logon Extensibility Sample and How-To


public string Identify(IExtendedLogOnInfo captureData,
ICollection<byte[]> candidates)
{
string logOnKey = null;
// Identify the give capture data from given cadidates and
return hash (e.g. MD5 HASH) of found cadidate.
return logOnKey;
}
}

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

9- 5

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

Module Review
Module Review and Takeaways

Understand how to extend Log on functionality in POS

Test Your Knowledge


Test your knowledge with the following questions.
1.

9-6

What Services project used for Logon functionality extension?

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 9: Logon Extensibility Sample and How-To

Test Your Knowledge Solutions


MODEL ANSWER:
1.

LogOn

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

9- 7

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

9-8

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

MODULE 10: POS THEMES


Module Overview
In this module you will understand how to change the look and feel of Microsoft
Dynamics AX for Retail POS registers by creating new Retail POS skins. To create
or modify existing Retail POS skins, you must obtain a license from DevExpress.
Retail POS uses DXExperience Winforms created by DevExpress. You can develop
your own forms without using DevExpress, but it is recommended you use these
to maintain a consistent look and feel.

Objectives

Understand how to create or modify existing Retail POS Skins

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

10 - 1

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

POS Skins
Creating a new skin

Go to the SkinEditor tool, which is typically found at <root>\Program


Files (x86)\DevExpress 2011.2\Components\Tools\Windows Forms
(where 2011.2 is the version number of the product). Double-click the
SkinEditor icon to launch the tool.

Click File->New to open the New Project window.

FIGURE 10.1: NEW PROJECT WINDOW

10 - 2

Set the Project Name to MyFirstCustomSkin.

Change the Template Skin: field from DevExpressStyle to Office 2010


Blue using the dropdown arrow.

Set the Skin Name: to MyFirstCustomSkin and click the OK button.


Your new skin project is now loaded within the SkinEditor tool, which
contains a list of UI elements called Products. For the remainder of
this topic, Products will be referred to as controls.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 10: POS Themes

FIGURE 10.2: CUSTOM SKIN WINDOW

Setting color properties on your new skin:

Select the common property from the SkinEditor Tool

FIGURE 10.3: SKIN EDITOR TOOL

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

10 - 3

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

Set the Common > Control color property to Blue.

Set the Common > ControlText color property to White.

Click File->Save.

You must now convert your project into an assembly that will be used
by Retail POS. Click File->Create Assembly. You should see a
confirmation dialog similar to the following:

FIGURE 10.4: ASSEMBLY GENERATED INFORMATION WINDOW


The newly generated skin assemblies are placed in the
<root>:\Users\<username>\Documents\My DXSkins\ directory. There will be a
folder beneath that directory with the same name as your skin, in this case
MyFirstCustomSkin. Inside that folder, you will find a MyFirstCustomSkin.dll.

Launching Retail POS with your new skin:


In order for Retail POS to load your new skin, you must place the skin assembly in
the Retail POS runtime folder. Copy the MyFirstCustomSkin.dll to the Skins folder
underneath the Retail POS runtime directory.
You also need to make Retail POS aware of your new skin.

Using Commerce Data Exchange: Synch Service

10 - 4

Open Microsoft Dynamics AX for Retail Headquarters and go to


Retail->Setup->POS->Profiles->Visual Profiles.

Right-click the Theme dropdown and click View Details.

Click the New button and set the POS skin name field to
MyFirstCustomSkin.

Close the POS skins form and with the POS visual profiles form still
open, set the Theme dropdown to MyFirstCustomSkin. Close the
form.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 10: POS Themes

Go to Retail->Periodic->Data Distribution->Distribution Schedule.


Select the N-1090 job and then click the Run directly button. This will
synch the new skin to Retail POS. You can run the following query
against the AXRetailPOS database to make sure this procedure
worked:

SELECT POSSKINNAME, * from RetailVisualProfile

Launch Retail POS and your new skins visualization effects should
display similar to the following image.

FIGURE 10.5: SKIN VISULATION EFFECTS DISPLAY

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

10 - 5

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

Module Review
Tools
DevExpress SkinEditor Tool.

Test Your Knowledge


Test your knowledge with the following questions.
1.

10 - 6

How will you update the new skin created using the tool in POS

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 10: POS Themes

Test Your Knowledge Solutions


Module Review and Takeaways
1.

How will you update the new skin created using the tool in POS
MODEL ANSWER:

In order for Retail POS to load your new skin, you must place the skin
assembly in the Retail POS runtime folder. Copy the
MyFirstCustomSkin.dll to the Skins folder underneath the Retail POS
runtime directory. Also update the new skin name in Retail->Setup>POS->Profiles->Visual Profiles and run the N-1090 scheduler job.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

10 - 7

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

10 - 8

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

MODULE 11: USER-INTERFACE EXTENSIBILITY


SAMPLE AND HOW-TO
Module Overview
Microsoft Dynamics AX for Retail POS introduces a new way to customize forms
by using the Interaction service. Multiple developers can use this service to
customize one or more forms in one service. If there are multiple customizations,
the Interaction service loads only the first customization it finds for a form. This
module also explains how to customize forms that are not part of the Interaction
services.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

11 - 1

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

How to Modify a Form in Microsoft Dynamics AX 2012


R2 POS
This lesson explains how to modify the Microsoft Dynamics AX 2012 R2 POS forms
in Interaction service and other services forms.

Lesson Objectives

Explain how to customize a form by using the InteractionDefault


service.

Explain how to customize forms in POS Plugins without using the


InteractionDefault service.

Customizing Forms by Using InteractionDefault Service


The following list of forms use this new pattern and their implementations are
included in the InteractionDefaults service.

11 - 2

ExtendedLogOnForm

ExtendedLogOnScanForm

frmBarcodeSelect

frmDimensions

frmInput

frmPayCash

frmPayCurrency

frmPayCustomerAccount

frmReturnTransaction

LogbookForm

LogOnForm

ManagerAccessForm

RegisterTimeForm

ViewTimeClockEntriesForm

ProductDetailsForm

ProductInformationForm

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 11: User-Interface Extensibility Sample and How-To


To customize an interaction form, follow these steps.
1.

In the folder where you installed the Retail POS SDK, open the
Microsoft Dynamics AX for Retail POS Plug-ins folder.

2.

Open the Services folder and double-click the Services Visual Studio
solution file.
In this step, you override the LogOnForm form. This form has a
dependency on the ManagerAccessForm.

3.

To change the background color, right-click the LoOnForm.cs from


InteractionDefuslt project and select View Code.

4.

Add the following code to the OnLoad() method for the first line of
the method to change the back ground color to dark red.

Sample code to change the form background color


((Form)this.BackColor = Color.DarkRed;

5.

Compile the InteractionDefaults project.

6.

Copy the new assembly to the


Pos\Services\InteractionDefaults\Extension folder and start Retail POS.
The LogOnForm should resemble the following:

FIGURE 11.1: OPERATOR ID WINDOW

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

11 - 3

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization
How to Modify a Form in the Microsoft Dynamics Ax 2012
R2 POS Item Search Form
This topic explains how to add a new column to the existing Item search form
and view that form in the POS user interface (UI). For example, you will add the
column SerachName of the Item in the Item search form. You will fetch this
column value from the ECORESPRODUCT table.
To customize the ItemSearch form, follow these steps.
By default, in the folder where you installed the Retail POS Software Development Kit
(SDK), it will be located at C:\Users\...\Documents\Retail SDK\POS Plug-ins.
1.

Open the Microsoft Dynamics AX for Retail POS Plug-ins folder. For
more information about how to install the Retail SDK, refer to the
installation guide.

2.

Open the Services folder and double-click the Visual Studio solution
file, services.sln.

3.

Open the Services folder and double-click the Services Visual Studio
solution file.

4.

Click the Dialog project and expand the WinFormsTouch Folder.


Click frmItemSearch.cs and select view code. To modify the forms,
you must have a DevExpres license.

5.

Add the following code in the variable declaration section of the


frmItemSearch class to declare the new column.

private DevExpress.XtraGrid.Columns.GridColumn colSearchString;

6.

Initialize the column in InitializeComponent() method.

this.colSearchString = new evExpress.XtraGrid.Columns.GridColumn();

7.

You must add the column in the gridView to appear in the form. For
this include the new column in the range and set the column
properties in InitializeComponent() method.

this.grdView.Columns.AddRange(new
DevExpress.XtraGrid.Columns.GridColumn[] {
this.colItemName,
this.colItemId,
this.colSearchString,
this.colItemPrice,
this.colItemUnitOfMeasure,
this.colItemTaxRate,
this.colItemOwnThirdProduc,
this.colItemRoundTrunc});

11 - 4

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 11: User-Interface Extensibility Sample and How-To


//
// colSearchString
//
this.colSearchString.Caption = "Search name";
this.colSearchString.FieldName = "SEARCHNAME";
this.colSearchString.Name = "colSearchString";
this.colSearchString.OptionsColumn.AllowSort =
DevExpress.Utils.DefaultBoolean.False;
this.colSearchString.SortMode =
DevExpress.XtraGrid.ColumnSortMode.Custom;
this.colSearchString.Visible = true;
this.colSearchString.VisibleIndex = 0;
this.colSearchString.Width = 161;

8.

Now, modify the Item Search query to include the new column in the
search criteria for filtering and displaying in the GetItemList() method.

string query = string.Format("SELECT ITEMID, ITEMNAME, '' AS


ITEMPRICE,I.SEARCHNAME, I.UNITOFMEASURE, I.INVENTPRODUCTTYPE_BR
" +
"FROM ( " +
"
SELECT IT.INVENTPRODUCTTYPE_BR, IT.ITEMID,
COALESCE(TR.NAME, IT.ITEMNAME, IT.ITEMID) AS ITEMNAME, IT.DATAAREAID,
ISNULL(IM.UNITID, '') AS UNITOFMEASURE, ROW_NUMBER() " +
"
OVER (ORDER BY IT.{0} {1}) AS ROW " +
"
FROM ASSORTEDINVENTITEMS IT " +
"
JOIN INVENTTABLEMODULE IM ON IT.ITEMID =
IM.ITEMID AND IM.MODULETYPE = 2 " +
"
JOIN ECORESPRODUCT AS PR ON PR.RECID =
IT.PRODUCT " +
"
LEFT JOIN ECORESPRODUCTTRANSLATION AS TR
ON PR.RECID = TR.PRODUCT AND TR.LANGUAGEID = @CULTUREID " +
"
WHERE IT.STORERECID = @STORERECID {2}) I "
+
"WHERE I.DATAAREAID=@DATAAREAID AND I.ROW >
@FROMROW AND I.ROW <= @TOROW ", sortBy, asc, search);

9.

Build the project in release mode and replace the Dialog.dll in the
Retail POS\Services\Extension folder. This path is applicable only for
Microsoft Dynamics AX 2012 R2. For later versions use
POS\Extensions.

10. Start the POS and then click the Product search button that is added
in the POS layout. The Item search form should resemble the
following.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

11 - 5

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

FIGURE 11.2: PRODUCT SEARCH WINDOW

11 - 6

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

MODULE 12: TRIGGER EXTENSIBILITY SAMPLE


AND HOW-TO
Module Overview
Triggers are used to capture events that start before and after Microsoft Dynamics
AX for Retail POS operations. You can insert custom logic before the operation
runs or after it is completed. The Retail POS IOperationTriggers interface
introduces new generic triggers called the PreProcessOperation and
PostProcessOperation.

Objectives

Explain how to extend triggers in Microsoft Dynamics AX 2012 R2


POS.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

12 - 1

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

How to Modify the Trigger Project


This lesson explains how to modify the triggers. To extend the triggers, you will
use the operation triggers as an example and then customize these triggers. You
will update the GiftCardBalance operation by asking the customer if he or she
wants to add his or her balance after it is verified.

Lesson Objectives

Explain how to customize triggers and how the triggers are used.

How to Modify the OperationsTrigger Project


To modify the OperationsTrigger project, follow these steps.
1.

Back up the existing assembly before any modification. If you must


revert for any reason, the original assemblies will be available in such
scenarios.

2.

Browse to the folder where the Retail POS Software Development Kit
(SDK) is installed. By default, it will be located at
C:\Users\...\Documents\Retail SDK\POS Plug-ins\.

3.

Open the Triggers folder and double-click the Triggers Visual Studio
solution file.

4. Add a reference to the following assemblies that are located in the


Retail POS runtime folder:
o

DevExpress.Utils.v11.2.dll

o POSProcesses.dll
o System.Windows.Forms.dll
5.

Update the GiftCardBalance operation by asking the customer if he or


she wants to add to his or her balance after it is verified.

6.

Open the OperationTriggers.cs file and locate the


PostProcessOperation method.

7.

Add the following C# code:

public void PostProcessOperation(IPosTransaction posTransaction,


PosisOperations posisOperation)
{
if (posisOperation == PosisOperations.GiftCardBalance)
{
using (var form = new
LSRetailPosis.POSProcesses.frmMessage("Would you like to add to your gift
card amount?", MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
{
LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSForm(form);
if (form.DialogResult == DialogResult.OK)

12 - 2

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 12: Trigger Extensibility Sample and How-To


{
//reference existing or new logic for adding money
to customer gift cards
}
}
}
else
{
LSRetailPosis.ApplicationLog.Log("IOperationTriggersV1.PostProcessOperatio
n", "After the operation has been processed this trigger is called.",
LSRetailPosis.LogTraceLevel.Trace);
}
}

8.

After you build the project, put the assembly in the Retail
POS\Services\Extensions folder. This path applies only to Microsoft
Dynamics AX 2012 R2. For later versions, use POS\Extensions.

9.

Start the POS runtime and perform the Gift card balance operation.

10. After you receive the balance, the dialog box appears with the
customer message that is written in the post process.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

12 - 3

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

12 - 4

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

MODULE 13: SERVICES EXTENSIBILITY SAMPLE


AND HOW-TO
Module Overview
Microsoft Dynamics AX 2012 includes a collection of core services that can be
customized or replaced by using Retail POS Plug-ins. You can also create new
services that can be started from existing services or triggers.

Objectives

Explain how to extend services in Microsoft Dynamics AX 2012 R2


POS.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

13 - 1

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

How to Modify the Services Project


Services include one or more operations and implement a single, unique interface.
You can make modifications to an existing service and continue to use the
remaining functionality.

Lesson Objectives

This lesson explains how to modify the Z-Report by using EOD


services project.

How to Modify the Z-Report


Example:
If, in the Z-report, you want to print the count of a returned transaction in the
shift, you can do the following:
1.

Before the modification, take the backup of the existing assembly so


that the original assemblies will then remain available if you must
revert to them.

2.

Browse to the folder where you installed the Retail POS Software
Development Kit (SDK). By default, this folder will be located at
C:\Users\...\Documents\Retail SDK\POS Plug-ins\.

3.

Open the Services folder and double-click the Services Visual Studio
solution file.

4.

Browse to the EOD project and double-click the BatchPrinting.cs file


and add the following new method:

public static int CalculateReturnransactionCount(Batch batch)


{
int count = 0;
DbConnection connection =
ApplicationSettings.Database.LocalConnection;
if (connection.State != ConnectionState.Open)
connection.Open();
string query = "SELECT COUNT(S.TRANSACTIONID) FROM
RETAILTRANSACTIONTABLE H INNER JOIN RETAILTRANSACTIONSALESTRANS S ON " +
"H.TRANSACTIONID = S.TRANSACTIONID AND
H.STORE = S.STORE AND H.TERMINAL = S.TERMINALID AND H.DATAAREAID =
S.DATAAREAID " +
"WHERE H.STORE = @STOREID " +
"AND H.BATCHTERMINALID =
@BATCHTERMINALID " +
"AND H.DATAAREAID = @DATAAREAID " +
"AND H.BATCHID = @BATCHID " +
"AND S.QTY > 0";
using (DbCommand dBCommand = new SqlCommand())
{
dBCommand.Connection = connection;
dBCommand.CommandText = query;
dBCommand.Parameters.Clear();

13 - 2

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 13: Services Extensibility Sample and How-To


if (batch != null)
{
dBCommand.Parameters.Add(new
SqlParameter("@STOREID", batch.StoreId));
dBCommand.Parameters.Add(new
SqlParameter("@BATCHTERMINALID", batch.TerminalId));
dBCommand.Parameters.Add(new
SqlParameter("@BATCHID", batch.BatchId));
dBCommand.Parameters.Add(new
SqlParameter("@DATAAREAID", ApplicationSettings.Database.DATAAREAID));
}
count = DBUtil.ToInt32(dBCommand.ExecuteScalar());
return count;
}

5.

Locate the Print method (this Batch batch, ReportType reportType) in


the BatchPrinting.cs file and then add the following line of code after
the line reportLayout.PrepareHeader(batch, reportType);

reportLayout.AppendLine(string.Format("Return count{0}",CalculateNegativeTransaction(batch)));

6.

After you do this, build the project and put the assembly in the Retail
POS\Services\Extensions folder. This path applies only to Microsoft
Dynamics AX 2012 R2. For later versions, use POS\Extensions.

7.

Start the POS runtime and perform the Z-report operation to view the
changes in the report.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

13 - 3

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

13 - 4

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

MODULE 14: BLANK OPERATION EXTENSIBILITY


Module Overview
You can use Blank Operations to extend Microsoft Dynamics AX for Retail Pointof-Sale (POS) by adding custom logic to the Retail POS register buttons. In the
Retail POS register design layout, you can add any number of blank operation
buttons and specify the operations information for each button. Later in this
module, you will learn how to add a blank operation and specify the operation
information.

Objectives

Explain how to create a blank operation and add it to POS layout.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

14 - 1

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

Blank Operation on the Retail POS Register


This lesson explains how to set up a blank operation and add custom logic to the
blank operation

Setting Up a Blank Operation on the Retail POS Register


To set up a blank operation on the Retail POS register, follow these steps.
1.

Start Retail POS. Right-click the Cashier Tasks button and then select
Button Properties. The Configure button form opens.

2.

In the Action drop-down list, select Blank Operation. The Operation


number field is a string value that Retail POS uses to identify the
Blank Operation. Because you can send multiple blank operations to
Retail POS at the same time, you must give each blank operation a
unique identity so that Retail POS can distinguish which blank
operation to execute.

You can use the Blank Operation param field to send an optional string
parameter. The Operation number and Blank Operation param values combine to
form the method signature of the Blank Operation. In this scenario, set the
Operation number to MyTask and leave the Blank Operation param value to My
Param.
3.

You can use the fields under the Appearance tab on the right-side of
the Configure button form to customize the appearance of the
button. For example, you can set the text value that displays on the
button when Retail POS is started. Change the button name to
MyOperation, as shown in the following image:

FIGURE 14.1 CONFIGURE BUTTON FORM

14 - 2

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 14: Blank Operation Extensibility


Adding Custom Logic to the Blank Operation
To add custom logic to the Blank Operation, follow these steps.
1.

Browse to the folder where you installed the Retail POS Software
Development Kit (SDK). By default, it will be located at
C:\Users\...\Documents\Retail SDK\POS Plug-ins\.

2.

Open the Services folder and double-click the Services Visual Studio
solution file.

3.

Browse to the Blank Operations project and expand it.

4.

Right-click the reference node and then click Add reference and
browse for the assemblies POSProcessess in the Retail POS folder and
then select it, and then click OK.

5. Open the BlankOperation.cs file and find the BlankOperation method,


as shown in the following C# code example:

public void BlankOperation(IBlankOperationInfo operationInfo,


IPosTransaction posTransaction)

Notice the BlankOperation method takes two parameters: an operationInfo object


and a posTransaction object. The operationInfo object contains the
MyTask operation number and the My Param operation parameter that you set
on the MyOperation button of the Retail POS register. Retail POS uses that
Operation number to identify the Blank Operation that is being passed.
The posTransaction object contains all the information about the current
transaction.
Several Blank Operations can be handled in the one BlankOperation method. Use
a C# Switch statement on the operationInfo.OperationId value to capture the
specific Blank Operation that you must have. You can do this by adding the
following code to the BlankOperation method.
public void BlankOperation(IBlankOperationInfo operationInfo,
IPosTransaction posTransaction)
{
switch (operationInfo.OperationId)
{
case "MyTask":
//TODO: insert method call to your custom logic
LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSStatusPanelText("My task
operation is clicked");
operationInfo.OperationHandled = true;
break;
}

6.

Compile the BlankOperations project.

7.

Copy your new assembly to the POS\Services\Extension folder and


start Retail POS. This path applies only for Microsoft Dynamics AX
2012 R2. For later versions, use POS\Extensions.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

14 - 3

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization
8.

Click the Cashier Tasks button and then click the MyOperation
button. You will receive the following message in the status panel:

FIGURE 14.2: STATUS PANEL MESSAGE

14 - 4

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

MODULE 15: CUSTOM FIELDS ON POS LAYOUTS


Module Overview
This module explains how to add custom fields to Point-of-Sale (POS) layouts. In
Microsoft Dynamics AX for Retail 2012 R2, you can also add custom fields on POS
Receipt layouts.

Objectives

Explain how to add fields to the receipt layout.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

15 - 1

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

Custom Fields on the POS Layout


This lesson explains how to add fields to the receipt. You will learn how to add a
line item field that shows the time that the item is added to a transaction and a
header field that shows the total quantity of the whole transaction.

Adding Fields to the Receipt Layout


To create custom fields, follow these steps.
1.

When you create the custom fields, as with the custom fields for till
layout, receipt fields are defined in Headquarters on the Custom
Fields form
(Retail > Setup > POS > Profiles > Custom fields). For this
example, you will create two fields, both of the type
Receipt: TotalQty and TimeScanned.

FIGURE 15.1: CUSTOM FIELDS FORM


Any fields that are created in custom fields are available in all three sections of the
receipt format designerHeader, Lines, and Footer. The Caption text ID is a
unique identifier for the text that will show in the receipt format designer (unlike
the custom fields for till layout that use the Name in the designer, and the Caption
text ID in the POS). The Caption text ID is still stored in the RetailLanguageText
table and is only used at Headquarters.
Because there is no form to add strings to the RetailLanguageText table, you will
populate the values directly in the Application Object Tree (AOT).
2.

15 - 2

Open a new developer workspace and browse to Data Dictionary >


Tables > RetailLanguageText. Right-click and select Open.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 15: Custom Fields on POS Layouts


3.

Create two records by populating the languageID, Text and textID


fields:

FIGURE 15.2: NEW DEVELOPER WORKSPACE


To add the custom fields to the Receipt Layout, follow these steps.
After the fields are created they can immediately be added to any receipt format.
4.

Browse to Retail > Setup > POS > Receipt formats and then click
the Designer button for any receipt format.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

15 - 3

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

FIGURE 15.3: RECEIPT FORMATS


If the fields and labels are created correctly, you should be able to find them in
the field list for any of the three sections:

15 - 4

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 15: Custom Fields on POS Layouts

FIGURE 15.4: RECEIPT FORMAT DESIGNER

Note: You did not correctly create the RetailLanguageText record, if something
appears that resembles (22000)??Missing String??.
1.

Find a place to drag the Total Quantity and Time Scanned fields
onto the header section and give each a hard-coded text label. Make
sure that you press the Save button when you are finished.

2.

Run the A-1090 or N-1090 job to push the new receipt to the POS
database.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

15 - 5

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

FIGURE 15.5: RECEIPT FORMAT DESIGNER WITH TRANSACTION COMMENTS


HIGHLIGHTED
To connect the custom fields in code, follow these steps.
3.

Before the modification, take the backup of the existing assembly so


that the original assemblies remain available if you must revert to
them.

4.

Browse to the folder where you installed the Retail POS Software
Development Kit (SDK). By default, it will be located at
C:\Users\...\Documents\Retail SDK\POS Plug-ins\.

5.

Open the Services folder and then double-click the Services Visual
Studio solution file.

6.

Locate the FormModulation.cs file in the Printing service. Values


for the header and footer fields are handled in the
GetInfoFromTransaction() method and for lines it is the
GetInfoFromSaleLineItem() method. Locate the switch statement
for GetInfoFromTransaction() from the following code example.

switch (itemInfo.Variable.ToUpperInvariant().Replace(" ", string.Empty))


{
case "DATE":
return
((IPosTransactionV1)theTransaction).BeginDateTime.ToShortDateString();
case "TIME24H":
return

15 - 6

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 15: Custom Fields on POS Layouts


((IPosTransactionV1)theTransaction).BeginDateTime.ToString("HH:mm");

7.

To print a value for the custom field, you have to add the field name
to the switch statement.

case "TOTALQTY": return theTransaction.SaleItems.Sum(s =>


s.Quantity).ToString();

To use PartnerData fields for line items, follow these steps.


The header example used a simple calculated field to print a value. However, you
want to extend the RetailTransaction object to store extended values that can
then be printed on the receipt. You can do this with the PartnerData object that
is introduced in Microsoft Dynamics AX for Retail 2012 Feature Pack.
The PartnerData object is a dynamic collection that can be defined at run time
instead of compile time. Fields can be stored at the transaction level, the sales line
level, or the payment line level. These fields are then stored in transaction object
and can be used in triggers or services. In the example, you will create a field that
is named TimeAdded on the sales line and then use it when you print the
receipt.
8.

9.

Open the Triggers solution in Visual Studio and browse to the


ItemTriggers project. Now you have to add several things to the
project before you add the code.
o

The PartnerData object relies on a feature that is introduced in


C# 4.0. To use PartnerData in any of the POS code, the project
must add a reference to Microsoft.Csharp

The example uses the SaleLineItem POS object. This object is in


the Transaction class. The project also requires a reference to
the Transaction.DLL file from the POS installation folder. Make
sure that you set the Copy Local property to False when you add
this reference.

Finally, a using LSRetailPosis.Transaction.Line.SaleItem; line


must be added to the top of the ItemTriggers.cs file.

After this is set up, you must add the following lines to the PreSale()
method:

using LSRetailPosis.Transaction.Line.SaleItem;
[...]
public void PreSale(IPreTriggerResult preTriggerResult, ISaleLineItem
saleLineItem, IPosTransaction posTransaction)
{
SaleLineItem s = (SaleLineItem)saleLineItem;
s.PartnerData.TimeAdded = System.DateTime.Now.ToString("HH:mm:ss");

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

15 - 7

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization
10. Now you must read the TimeAdded value when you print sales lines
on the receipt. This is performed in the FormModulation.cs again,
this time in the GetInfoFromSaleLineItem() method.
switch (itemInfo.Variable.ToUpperInvariant().Replace(" ", string.Empty))
{
case "TIMESCANNED": returnValue = saleLine.PartnerData.TimeAdded;
break;
case "TAXID":
returnValue = saleLine.TaxGroupId;
break;

11. Compile the ItemTriggers.dll and Printing.dll and then copy them to
the POS\Services\Extension subfolder in the POS installation. This
path applies only to Microsoft Dynamics AX 2012 R2. For later
versions, use POS\Extensions.
12. Start POS and print a receipt by doing a sale transaction so that you
will able to view the modification in POS.
Similar to this, you can also add custom fields on the following:

15 - 8

Payment Grid

Product Receipt Grid

Totals Area

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

MODULE 16: REAL-TIME SERVICES EXTENSIBILITY


SAMPLE AND HOW-TO
Module Overview
With Real-time Service, retail clients can interact with Microsoft Dynamics AX retail
functionality in real time. You can extend Commerce Data Exchange: Real-time
Service by adding extension methods to the RetailTransactionServiceEx class. The
RetailTransactionServiceEx class is used as a service class between Microsoft
Dynamics AX and the Point-of-Sale (POS).

Objectives

Explain how to extend Commerce Data Exchange - Real time service


for POS.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

16 - 1

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

Extending the RetailTransactionServiceEx Class


To extend Real-time Service, you must create a new method in the
RetailTransactionServiceEx class. All transaction service new methods should be
created in this class.

RetailTransactionServiceEx Class
To extend the Real-time service, the methods must meet the following criteria:

They must be a public static method.

The return value must be a container of length two or more. The first
two elements must be a Boolean value that indicates whether the
method call is successful and a String value that you can use for a
comment or error message. The other items in the container can be
of any type. This includes nested containers.

The method parameters must be one of the following Microsoft


Dynamics AX primitive:
o

Boolean

date

int

int64

str

guid

Real

To add a method, follow these steps.


1.

In the Application Object Tree (AOT), right-click Classes >


RetailTransactionServiceEx, point to New, and then click Method.

2.

Add the custom business logic.

Example:
The following example shows a method that takes a customer account number
and returns a greeting message that uses the customers name. For example, if
customer account number 1001 is associated with a customer named Sandy, the
method would return Hello Sandy!
public static container Hello(AccountNum accountNumber)
{
CustTable custTable;
DirPartyTable dirPartyTable;
container result = [false, ''];

16 - 2

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 16: Real-Time Services Extensibility Sample and How-To


if (accountNumber)
{
select firstOnly Name from dirPartyTable
exists join custTable
where custTable.accountNum == accountNumber
&& dirPartyTable.RecId == CustTable.Party;
if (dirPartyTable)
{
result = [true, 'Success!', strFmt("Hello %1 !",
dirPartyTable.Name)];
}
else
{
result = [false, 'Customer not found'];
}
}
else
{
result = [false, 'accountNumber is null.'];
}
return result;
}

Here, you are calling the new method by using the POS BlankOperation.
public void BlankOperation(IBlankOperationInfo operationInfo,
IPosTransaction posTransaction)
{
switch (operationInfo.OperationId)
{
case "MyTask":
try
{
var response =
Application.Instance.TransactionService.InvokeExtension("Hello", "2014");
if (response.Count == 1)
{
LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSStatusPanelText(response
[0] as string);
}
}
catch (CommunicationException ex)
{
LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSStatusPanelText("Request
failed: {0}", ex.Message);
}
operationInfo.OperationHandled = true;
break;
}
}

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

16 - 3

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization
After you do this, compile the BlankOperations project and copy the new
assembly to the POS\Services\Extension folder and then start Retail POS. This path
applies only to Microsoft Dynamics AX 2012 R2. For later versions, use
POS\Extensions. Click the Cashier Tasks button and then click the MyTask
button. (Add the MyTask blank operation button if it is not yet added). For more
information, refer to the blank operation extension document for how to add a
custom blank operation button and how to customize this button). If the
account number exists it will display the customer name on the status panel.
To modify the existing methods in transaction service class
(RetailTransactionService), add a new pre-event handler or a post event handler
for that method and write the new method logic in the RetailTransactionServiceEx.
Example:
If a gift card is issued and you want to update a web service, create a new Post
handler and set the class as RetailTransactionServiceEx and the method as
UpdateGiftCardService. UpdateGiftCardService is the new method that is
implemented in the RetailTransactionServiceEx class to update the gift card web
service.
public static void UpdateGiftCardService (XppPrePostArgs _args)
{
// All the gift card arguments can be fetched from the _args parameter
// write your logic to update the service
}

To create a post handler, right-click the giftCardAddTo method, and then select
New Event Handler Subscription.
Now, set the properties shown as follows:

FIGURE 16.1: NEW EVENT HANDLER SUBSCRIPTION

By doing it in this manner, both the existing code and the custom code are
managed separately.

16 - 4

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

MODULE 17: POS PAYMENT CONNECTOR


Module Overview
Microsoft Dynamics AX 2012 R2 includes a unified payment processing
architecture for processing credit card transactions. You can extend this
architecture by creating your own payment connector. This payment connector
can be used for a single assembly in three locationsretail stores (POS registers),
online stores, and the Microsoft Dynamics AX Accounts Receivable module.
Microsoft Dynamics AX 2012 R2 includes one payment connectorthe Dynamics
Payment Connector. This payment connector is used to connect to the Dynamics
Online Payment Services provider.
You can extend Payment Services to include an additional payment connector by
implementing a specific interface. After you deploy a new payment connector, all
the Microsoft Dynamics AX payment configuration pages will display the required
fields to configure the payment connector. After you configure the payment
connector, you can validate it, and then use it on a retail channel. The new
payment connector can also support the new touch screen payment terminal
devices.

Objectives

Explain how to create the payment connector to work on all


Microsoft Dynamics channels for payment processing.

Disclaimer
You may copy, alter, adapt, modify or create derivative works of the Dynamics
Payment SDK and this TemplateConnector for the purpose of payment card
processing and use solely with Microsoft Dynamics AX 2012 R2 in your internal
business operations and with valid licenses of Microsoft Dynamics AX 2012 R2.
You will not, and will not permit or authorize any third party to distribute any of
the derivative works of the Payment SDK and this TemplateConnector.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

17 - 1

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

Payment Connector
You can use the payment connector to connect any Microsoft Dynamics channel
to the payment SDK for processing payments. You can also use the payment
connector to connect to different payment devices, such as Hydra.
The payment connector extends from a different interface to achieve the
functionality that is described earlier. Some components of the main interface are
listed as follows:

IPaymentManager
The Microsoft.Dynamics.Retail.PaymentManager.Reference.IPaymentManager is
the interface for all payment devices. It exposes the methods and events for
handling devices.

IPaymentProcessor
The Microsoft.Dynamics.Retail.PaymentSDK.IPaymentProcessor is the interface for
all the payment processing methods. It exposes the methods and events for
handling payments.

ISessionOperation
The Microsoft.Dynamics.Retail.PaymentSDK.ISessionOperation is the interface for
maintaining the session for processing. It exposes the methods and events for
handling sessions.
Some key methods of the payment connector include the following:
Methods

17- 2

Description

Authorize

Used to authorize the payment.

Refund

Used to refund the payment.

Void

Used to Void the transaction.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 17: POS Payment Connector


Create a Payment Connector
To create the payment connector, follow these steps.
1.

Install RetailPOS from the Microsoft Dynamics AX Setup and then


unzip the TemplateConnector.zip file. For the TemplateConnector
source code, download location and license information, refer to the
Microsoft Software License Terms agreement and the developer and
demonstration license agreement.

2.

Open TemplateConnector.csproj by using Visual Studio. For


Visual Studio requirements, refer the Development Environment
Requirements document.

3.

Right-click the TemplateConnector project and then click properties.


Rename the assembly name to the name that you want the assembly
to be called.

4.

On the Signing tab, sign your assembly with a strong name key file.
This is required if you want to deploy your payment connector to the
GAC for the online store.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

17 - 3

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

17- 4

5.

Open TemplateConnector.cs and change the following properties. List


the countries that the connector supports.

6.

Click View > Task List to display the task list. The task list shows all
the elements that you should customize for payment.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 17: POS Payment Connector

Custom Business Logic


You can use the template as a basis for the payment connector. However, you
must add custom business logic to make it function. The areas in the template
that require your attention are marked as TODOs in the task list.
For operations, such as authorize, capture, linked refund, and void, you must
create logic to call out to your payment provider. The logic can use information
from two placesmerchant properties as they are entered in Microsoft Dynamics
AX (IP address, username, password, and so on) and the payment request for this
transaction (card number, transaction amount, payment amount, and so on) that
is provided by the application. The results of the call to the payment provider are
then sent back to the application as a response object.
Each of these is a key and, or value data structure. Map the payment request
properties and the merchant properties to the data that is required by the
provider. When the payment provider returns a response, the data should be
extracted and entered in the variables as noted in the example. If you must store a
stable state that is returned by the payment provider, you can create new
properties in the response property bag. Then you can use these properties in
future calls to the payment provider.
Merchant properties contain metadata that Microsoft Dynamics AX uses to display
a user interface (UI) to enter the values. The values that are entered by the user in
Microsoft Dynamics AX are then automatically passed to the payment provider. In
the example, there is a merchant property named IPAddress to show how this is
performed.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

17 - 5

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization
Any error codes that are returned from the payment provider must be mapped to
the enumerated error codes in the Microsoft.Dynamics.Retail.Payment SDK. The
message that is contained in the error code can be customized as long as the
error code is mapped correctly.

Deploy the Payment Connector


How to use use the connector in the channels is described in the following
section. ,

Microsoft Dynamics AX
Copy the connector assembly to the Microsoft Dynamics AX client and the
following server Connectors directories:

%Program Files (x86)%\Microsoft Dynamics


AX\6.2\Client\Bin\Connectors

%Program Files%\Microsoft Dynamics


AX\6.2\Server\AxaptaDev\bin\Connectors

Now, restart the application object server (AOS).

Microsoft Dynamics AX for Retail POS


Copy the connector assembly to %Pos%\Connectors. (To copy this dll to multiple
installations of POS, you can use System Center.) After it is installed, start POS.

17- 6

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 17: POS Payment Connector


Entering Merchant Properties
Merchant properties for the payment connector must be entered in each location
that you plan to process card payments. When the assembly is deployed to
Microsoft Dynamics AX, it is automatically included in the payment connector
options and the custom merchant properties are available in the three forms.

Retail Stores
In Microsoft Dynamics AX, browse to Retail > Setup > POS > Profiles >
Hardware profiles. Select an existing hardware profile or create a new profile.
Under the EFT Service FastTab, select Payment Connector from the first dropdown list. The payment connector should then be available to select in the second
drop-down list. After you select it, your merchant properties should display:

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

17 - 7

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization
Accounts Receivable
To use the payment connector in the Microsoft Dynamics AX Accounts
Receivable module, you must browse to Accounts Receivable > Setup >
Payment > Payment services. Create a new payment service and give it a name.
Select the payment connector from the Payment connector drop-down list and
complete the merchant properties:

17- 8

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 17: POS Payment Connector

Module Review
Module Review and Takeaways

About Payment Connector

How to create Payment Connector

Deployment

Test Your Knowledge


Test your knowledge with the following questions.
1.

What is a payment connector?

2.

How do you deploy the payment connector in Microsoft Dynamics AX?

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

17 - 9

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

Test Your Knowledge Solutions


MODEL ANSWER:
1. You can use the payment connector to connect any Microsoft Dynamics

AX channel to the payment SDK for payment processing.


2. Copy the connector assembly to the Microsoft Dynamics AX client and the

server Connectors directories:

17- 10

%Program Files (x86)%\Microsoft Dynamics


AX\6.2\Client\Bin\Connectors

%Program Files%\Microsoft Dynamics


AX\6.2\Server\AxaptaDev\bin\Connectors

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

MODULE 18: POS DATABASE TOOL EXTENSIBILITY


FOR STORE AND OFFLINE DATABASE
Module Overview
The Retail Store Database Utility is used to create the store and the offline
database. The utility is also used to create a configuration file that is used to
identify Point of Sale (POS) registers. By default, the tool will create the standard
retail POS tables for both the store and the offline database. This module explains
how to extend this tool to execute custom SQL scripts for both the store and the
offline database.

Objectives

Explain how to extend the Retail Store Database utility to execute


custom SQL scripts.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

18 - 1

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

CreateDatabase Service
The CreateDatabase services project is part of the Retail Software Development Kit
(SDK). The SKD can be used to create and extend the retail database. This lesson
explains how to extend the CreateDatabase project to execute custom SQL
scripts. You will create a custom SQL script and try to execute the script by using
the retail store database utility. After the tool successfully runs, you can verify that
the commands in the custom script are executed and that the commands updated
the POSISINFO table with a current version.

Lesson Objectives

Explain how to extend CreateDatabase assembly to execute custom


script for POS.

Extend CreateDatabase Service


To extend the CreateDatabase service, follow these steps.
1.

Before the modification, make a backup of the existing assembly so


that the original assemblies will remain available if you must revert to
them.

2.

Browse to the folder where you installed the Retail POS SDK. By
default, it will be located in C:\Users\...\Documents\Retail
SDK\POS Plug-ins\. Open the Services\CreateDatabase folder and
double-click the CreateDatabase project file and then add the
following library references from the Retail POS folder:

3.

18 - 2

DataAccess

EntityFramework

POSResources

SystemSettings

Transaction

Microsoft.Dynamcics.Retail.Pos.Contracts

Microsoft.Dynamcics.Retail.Pos.DataEntity

Microsoft.Dynamcics.Retail.Pos.DataManager

Right-click the upgrade folder in the project and then click Add>New Item and in the dialog box. Select Text File and name it
Upgrade6.2.0.1.sql and then click OK. This will create a blank text file
in the Upgrades folder.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 18: POS Database Tool Extensibility for Store and Offline Database
4.

Now, copy the following statement into that file and then click the
Save icon.

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ExtensionSample](
[ID] [bigint] IDENTITY(1,1) NOT NULL,
[StoreNumber] [nvarchar](50) NOT NULL,
[StoreName] [nvarchar](50) NULL,
CONSTRAINT [PK_ExtensionSample] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY =
OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

5.

Double-click the POSISUPGRADES.xml file in the Upgrades folder and


then add the following section in the XML file after the last
</POSISUPGRADES> end section.

<POSISUPGRADES>
<UPGRADEVERSION>6.2.0.1</UPGRADEVERSION>
<UPGRADESCRIPT>Upgrade6.2.0.1.sql</UPGRADESCRIPT>
</POSISUPGRADES>

The overall POSISUPGRADES.xml file will resemble the following:


<?xml version="1.0" standalone="yes"?>
<NewDataSet>
<xs:schema id="NewDataSet" xmlns=""
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemasmicrosoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true"
msdata:MainDataTable="POSISUPGRADES" msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="POSISUPGRADES">
<xs:complexType><xs:sequence>
<xs:element name="UPGRADEVERSION">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="15" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="UPGRADESCRIPT" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="2147483647" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

2.19 - 3

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
<!-- Upgrade Id : AppMajor.AppMinor.DbVersion.ReservedForPartners -->
<POSISUPGRADES>
<UPGRADEVERSION>6.2.0.0</UPGRADEVERSION>
<UPGRADESCRIPT>Upgrade6.2.0.0.sql</UPGRADESCRIPT>
</POSISUPGRADES>
<POSISUPGRADES>
<UPGRADEVERSION>6.2.0.1</UPGRADEVERSION>
<UPGRADESCRIPT>Upgrade6.2.0.1.sql</UPGRADESCRIPT>
</POSISUPGRADES>
</NewDataSet>

Note: In the POSISUPGRADES.xml always enter the Upgrade Version as a numeric.


The Upgrade Version should be greater than the earlier version. The assembly will
always query the XML for the script version which is greater than the base version.
If you enter a lesser or non-numeric value the script will not be executed.
Example: If the earlier upgrade script version is 6.2.0.0, then the next version will
be 6.2.0.1 and so on. The script file name can be any name in the XML file.

18 - 4

6.

Compile the project and put the assembly in C:\Program Files


(x86)\Microsoft Dynamics AX\60\Retail Database
Utility\Services.

7.

Start the RetailDatabaseUtility and enter the store server and the
offline server name. Also enter the database details together with the
Store, terminal and Datatarea id and then click continue. In the
dialog box, you can view the customer script that is being executed
and the ExtensionSample custom table that is being created in both
the store and the offline database.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

MODULE 19: EXTENSIBILITY TESTING


CONSIDERATIONS
Module Overview
This module explains the different ways to test Point of Sale (POS) and the
information that must be considered before testing.

Objectives

Explain the testing considerations for several testing types for the POS
customization.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

19 - 1

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

Testing
Types of Testing
Unit Testing
Unit tests are written by developers and run under a unit testing framework, such
as Microsoft Visual Studio Team System or NUnit. Unit tests isolate and verify
discrete units of program logic. They isolate the logic by replacing dependencies
on the run-time environment, such as SharePoint, with test-provided substitutes.
Isolation lets unit tests run quickly, and developers can run unit tests frequently.

Acceptance Testing
Acceptance tests consist of multiple steps that represent realistic usage scenarios
for the whole application. These tests verify that an application meets the
requirements of the intended users. Their scope includes usability, functional
correctness, and performance. Generally, test engineers create these tests.

Configuration Testing
This is usually performed by the performance testing engineers. The objective is to
determine minimal and optimal configuration of hardware and software, and the
effect of adding or modifying configurations.

Functional Testing
This is performed by functional and, or testing teams. This is a type of black box
testing that bases its test cases on the specifications of the Microsoft Dynamics Ax
POS implementation under test.

Integration Testing
This is usually conducted by testing teams. The Microsoft Dynamics AX POS
implementation usually involves integrations with several modules, and external
devices, such as a magnetic strip reader MSR, and the bar code scanner
components, such as payment gateway. Integration testing is performed by
combining all the modules, devices and external components and testing them as
a group.

Performance Testing
This is usually conducted by the performance engineer. It involves Functional
testing that is conducted to evaluate the compliance of a system or component
with specified performance requirements.

19 - 2

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 19: Extensibility Testing Considerations


User Interface (UI) Testing
This is performed by functional and, or testing teams to check how user-friendly
the application is.

POS Automation Testing


Some standard POS operations testing can be automated by using the standard
POS test automation functionality. If you modify the POS shortcut and append a te as a command-line argument, POS will run in a special test mode where POS
runs the tests that are set up in the Retail POS database.
For example: To automate the POS operation, insert records in the POSISTESTs
table and the POSISTESTPROCESS table by using the following scripts:
INSERT INTO [dbo].[POSISTESTS]
([NAME]
,[ITERATIONS]) VALUES
(<NAME, nvarchar(50),> ,<ITERATIONS, int,>)
GO
INSERT INTO [dbo].[POSISTESTPROCESSES]
([TESTID]
,[PROCESSID]
,[EXTRAINFO]
,[TIMETOWAIT]
,[ITEMLINEID]
,[TENDERLINEID]
,[NUMPADQUANTITY]
,[NUMPADVALUE])
VALUES
(<TESTID, int,>
,<PROCESSID, int,>
,<EXTRAINFO, nvarchar(50),>
,<TIMETOWAIT, int,>
,<ITEMLINEID, int,>
,<TENDERLINEID, int,>
,<NUMPADQUANTITY, numeric(28,12),>
,<NUMPADVALUE, nvarchar(50),>)
GO

Hardware Testing
This tests the hardware devices that are connected to a POS application that has
different configurations. Before testing the device with POS, you must test all the
hardware devices with the test utility that is provided by the device manufacturer
to make sure that the devices are working correctly.

Bar code Scanner


The testing of bar code scanners checks whether the scanner reads the code of an
item correctly and displays the price that corresponds to that item.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

19 - 3

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization
Printers
The testing of printers verifies whether the correct information that is related to
an item is printed on various receipts that are generated at the printer. The correct
information that is related to the customer, such as the ordered items and the
total should be printed on the receipts.

Weighing Scale
The testing of scales are used to weigh items sold by weight. The scale should
display the exact quantity of an item that is put on the scale to weigh and its price
should be displayed according to the weight of the item.

Cash Drawer
The testing of the cash drawer checks whether the cash drawer opens when an
order is submitted or when a check is settled.

Line Display
The testing of the tower displays the ordered item and its price. This helps the
customer to view the item he or she ordered. It also displays the due amount,
tendered amount and the change that is given to the customer. A tower is tested
against this information to check whether correct information is displayed on the
tower.

Keyboard
The testing of the POS keyboard checks whether the correct keyed data is
displayed and processed.

EFT Testing
Before the EFT solution is deployed in production, it should be tested several
times by using the test emulator or the test Portable Electronic Device (PED) that
is provided by the payment service provider. It should also display the PCI
complaint.

ISV Integration Testing


If there is integration to any Independent Software Vendor (ISV), test all the POS
standard operations.

19 - 4

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 19: Extensibility Testing Considerations

Challenges
Multiple Configurations
Testing a POS application that has different settings and configurations is a
cumbersome task. Test cases should be designed that include each scenario (valid
or invalid) in detail. Therefore, a significant budget should be put into testing of
such applications to prevent any major issues at the customer end.

Peripheral Issues
The peripheral issues can be related to devices that are connected to a POS, such
as bar code scanners, scales, printers, towers and cash drawers.

Complex Interfaces
Integration of the POS system involves several interconnected systems and thirdparty elements. Systematic test design techniques are followed to reduce the
complexity of interfaces.

Test Lab Maintenance


Because lots of hardware is normally connected to a POS, it requires a large
amount of space to house this hardware. You also have to put some effort and
expense in to keeping the hardware in good repair.

Upgrades
Rapid technological advancements are necessary for frequent hardware and
software upgrades that require more infrastructure.

PCI Compliance
Care must be taken to implement the PCI-compliant, tamper-proof infrastructure
at all POS terminals to protect cardholder data and identity.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

19 - 5

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

Testing Considerations
Testing considerations include the following:

Unit Testing Considerations

Ability of the system to correctly process incorrect transactions

Systems or components pass data and control correctly to one


another

Acceptance Testing Considerations

Define the acceptance criteria

Define the Suite of Tests

Could include both functional testing and UI testing

Configuration Testing Considerations

Frequency of the data distribution batches

Need of offline POS

Hardware configuration needed for every terminal for every store


server

Functional Testing Considerations

Identification of functions that the Microsoft Dynamics AX


POS implementation is expected to perform

How to create input data based on the functional specifications

Determination of output based on the functional specifications

Execution of the test case

Comparison of actual and expected outputs

Integration Testing Considerations

19 - 6

Test data while integrating with the external components

Emulators (or actual devices) for individual devices

End to end functional testing (smoke testing) after all the modules are
integrated

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 19: Extensibility Testing Considerations


Performance Testing Considerations

Load testing for all terminals for each store server and for each store
server for every real-time server

Data volumes

Load testing of POS for item scanning

Frequency of the scheduler jobs

Hardware configuration and sizing

Network latency and bandwidth

UI Testing Considerations

Ease of usage

Screen resolution of the target systems

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

19 - 7

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

Module Review
Module Review and Takeaways

Explain the different testing that is involved in the POS


deployment

Explain the testing challenges involved

Points to be considered before testing

Test Your Knowledge


Test your knowledge with the following questions.

19 - 8

1.

What is the command that is used to start POS in test mode?

2.

In which table is the POS automation test scripts inserted?

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 19: Extensibility Testing Considerations

Test Your Knowledge Solutions


MODEL ANSWER:
1.

-te

2.

POSISTESTs and POSISTESTPROCESS

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

19 - 9

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

19 - 10

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

MODULE 20: EXTENSIBILITY DEPLOYMENT AND


HOTFIX UPDATE CONSIDERATIONS
Module Overview
This module provides information and resources to help you successfully deploy
the Microsoft Dynamics AX 2012 R2 Point of Sale (POS) customization and
hotfixes. It addresses the steps that are involved in the planning of and the
considerations for the Retail POS customization and hotfix deployment.

Objectives

Explain deployment planning.

Explain the steps that are required for the retail hotfix or for the
update deployment.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

20 - 1

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

Deployment Planning
This lesson provides information about the planning that is required for the POS
deployment.

Deployment Components
The types of computers that are used in a typical Microsoft Dynamics AX 2012 R2
POS deployment are included in the following table:
Deployment location
Each Store

Type of computers
Database Server
POS Registers
CDX: Synch Service and Real-time service

Before a deployment, correct planning should be conducted to minimize the


downtime of the system. The deployment should first be conducted in the
following environment before the production environment.
Test environment A test environment is an environment where Microsoft
Dynamics AX POS customizations and solutions, possibly from different vendors,
are deployed, integrated, and tested.
Staging or pre-production environment A staging environment is an
environment that is built based on the production environment. Typically, it
contains business data from the production system. Microsoft Dynamics AX
models and customizations are moved to a staging environment after they are
integrated and tested on a test environment.
Production environment A production environment is the final environment
that customers use to run their business.

20 - 2

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 20: Extensibility Deployment and Hotfix Update Considerations

Deploy POS Customizations


This topic describes the deployment process for updates. Updates include hotfixes,
cumulative updates, service packs, and feature packs.

Before You Begin


Before you deploy updates in a retail environment, following these steps.
1.

Run P jobs to synchronize local transactions with headquarters. For


more information, refer to Schedule and run jobs in Retail Scheduler.

2.

Back up the store database by using Microsoft SQL Server


Management Studio.

All instances of these applications must be updated to the same version. Partly
updated environments are not supported. It is likely that deployed fixes will not
be fully available until all components in an environment are running the same
versions.
Updates for retail environments can be either binary or application updates.
Application updates are installed the same as other Microsoft Dynamics AX
application updates, by installing to a database server, and then recompiling.
Only binary updates require additional actions. You must synchronize your
databases with headquarters, back up the database, install binary updates to nondatabase and database components, and then if you have customized Retail POS,
you must re-merge your code changes to services and triggers, compile, and redeploy.
Before you deploy the POS customized libraries, make a backup of the existing
Retail POS folder and then copy the custom libraries. Copy the customized
services or triggers library to POS\Extension.
For more information about the retail general deployment, refer to the Deploy
Retail POS and Deploy Retail POS Updates.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

20 - 3

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

Merge Any Existing Code Changes with POS and


Redeploy
When updates are applied to POS, the updates replace all the modified services
and triggers libraries. If you have customized services or triggers, they will be
overridden by the hotfix. As a best practice, you should put all the customized
service or triggers libraries in the POS\Extension folder. This helps avoid the hotfix
from overriding your customization. However, if you have put the customizations
in the Services for Triggers folder, you must re-merge the code changes to the
services and triggers, and then complete and re-deploy the code changes. Also
verify that the code changes in the hotfix do not conflict with the code. However,
if the code changes do conflict, merge the code, compile and then re-deploy the
code changes in the POS\Extension folder. After you install the hotfix, if there is
any code change in services or triggers, the respective files will be available in the
updated Retail Software Development Kit (SDK) folder. By default, they will be
located in C:\Users\...\Documents\Retail SDK\POS Plug-ins\.

Merging Code from ISV


If you have ISV code in your POS, then the ISV code should also be merged with
the code changes from the hotfix. Then you can compile and re-deploy the code
changes in in POS\Extension folder.

Merging Code in TFS Branch


If there are multiple developers working on the POS customization then the hotfix
code changes should be merged in the code branch. By doing this, all developers
will have the latest code.

Install Updates to Non-Database Retail Components


To install updates to non-database retail components, follow these steps.
1.

Locate where you extracted the files for the update, and then doubleclick AxUpdate.exe.

2.

Install the updates on the local components.

You do not have to restart the Application Object Server (AOS) after you install
the binary retail components.

20 - 4

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 20: Extensibility Deployment and Hotfix Update Considerations


3.

If a retail database update is included in the update that you are


applying, the binary updates that you install include an updated
version of the Retail Database Utility. If database updates are present,
you must run the Retail Database Utility after you complete the
installation on the server that hosts the store database, and on any
POS registers with offline store databases. For detailed information,
refer to Install binary updates to online and offline store databases by
using the Retail Database Utility.

4.

Repeat steps 1 through 3 for all computers that run retail


components.

Install Updates to Store Databases by Using the Retail


Database Utility
To install updates to store databases by using the Retail Database Utility, follow
these steps.
1.

Click Start > All Programs > Microsoft Dynamics AX > Retail
Database Utility > Retail Database Utility to open the Retail POS
configuration form.

2.

Verify the values for the store database and then click Continue.

Database update scripts are executed.


Any offline databases are automatically upgraded at the same time.
If an update changes the database schema, you are prompted to set up again.
Also compare the hotfix script with the custom script and verify that there is there
is no conflict. If there is a conflict, merge the script and clear the conflicts and then
run the utility to update the modified changes in the store database and the
offline database.
For more information about how to run custom scripts by using the Retail
database utility, refer to the training document for POS Database Tool
Extensibility.

Install Update to CDX: Real-Time Service


If you have any modification in real-time service classes, then the code must be
merged with the changes in the hotfix. To avoid this, as a best practice always
write the customized code in the RetailTransactionServiceEx class so that the
customized code will not have any effect on the hotfix or the update installation.
For more information about Microsoft Dynamics AX hotfixes and how to update a
deployment, refer to Apply Hotfix and Update AX 2012.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

20 - 5

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

Module Review
Module Review and Takeaways

Merge POS Customization with POS Hotfix

Install updates to database and non-database retail components

Install updates to CDX: Real-time service

Test Your Knowledge


Test your knowledge with the following questions.

20 - 6

1.

What are the areas that should be considered to merge the POS code hotfix?

2.

What tool is used to deploy POS database updates?

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 20: Extensibility Deployment and Hotfix Update Considerations

Test Your Knowledge Solutions


MODEL ANSWER:
1. Customized and ISV code
2. Retail Database Utility

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

20 - 7

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

20 - 8

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

MODULE 21: EXTENSIBILITY LAB MANUAL


Module Overview
This lab manual provides steps on how to extend Blank Operations, Triggers,
Services and CDX: Real time Service.

Objectives

Understand how to create blank operation to and add it to POS


layout.

Understand how to extend triggers in AX 2012 R2 POS

Understand how to extend services in AX 2012 R2 POS

Understand how to extend Commerce Data Exchange- Real time


service for POS

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

21 - 1

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization
Exercise 1: Blank Operation Extensibility
Blank Operations enable you to extend Microsoft Dynamics AX for Retail POS by
adding custom logic to the Retail POS register buttons. In the Retail POS register
design layout you can add any number of blank operation button and specify the
operations information for each button. Later in this guide we will see how to add
blank operation and specify the operation information.

Exercise Scenario
We will add an item to POS transaction and the get the description of the item
and try to search the item description in the Web browser by opening the internet
explorer with the search text (item description)

Task 1: Adding custom logic to the Blank Operation to get item


description and search in Bing
High Level Steps
1.

Open the Blank Operation project in Visual studio

2.

Add Blank Operation on the Retail POS register

3.

Adding item to POS transaction

Detailed Steps
1.

Open the Blank Operation project in Visual studio


a.

The lab exercise should be performed on the vm - AX2012R2Av2

b.

Open Retail POS Plug-ins from the folder where you installed the
Retail POS SDK. By default it will be C:\Users\...\Documents\Retail
SDK\POS Plug-ins\.For more information about how to install
Retail POS Plug-ins, see Install the Retail SDK.

c.

Open the Services folder and double-click the Services Visual


Studio solution file.

d.

Go to the Blank Operations project and expand it.

e.

Right click the reference node and click Add reference and
browse for the assemblies POSProcessess in Retail POS folder and
select it and click ok.

f.

Right-click the BlankOperation project and select properties. In


the properties windows click Build and set the Configuration to
Release and also change the build mode to Release from the drop
down menu in the visual studio menu bar.

g.

Open the BlankOperation.cs file and add the below line in the
namespace section

using System;

21 - 2

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 21: Extensibility Lab Manual


h.

Open the BlankOperation method in BlankOperation.cs file and


find the BlankOperation method, then copy paste the code inside
the method public void BlankOperation(IBlankOperationInfo
operationInfo, IPosTransaction posTransaction)as shown in the
below snippet:

public void BlankOperation(IBlankOperationInfo operationInfo,


IPosTransaction posTransaction)
{
try
{
switch (operationInfo.OperationId)
{
case "BingSearch":
LSRetailPosis.Transaction.RetailTransaction retailTransaction =
posTransaction as LSRetailPosis.Transaction.RetailTransaction;
if (retailTransaction == null ||
retailTransaction.SaleItems.Count == 0)
{
LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSStatusPanelText("Please
add item to transaction");
operationInfo.OperationHandled = true;
return;
}
string description =
retailTransaction.GetItem(operationInfo.ItemLineId).Description;
System.Diagnostics.Process.Start("IExplore.exe",
"www.bing.com/search?q=" + description);
operationInfo.OperationHandled = true;
break;
}
}
Catch(Exception ex)
{
LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSStatusPanelText(ex.Messa
ge);
}
}

i.

Compile and Build the BlankOperations project by right clicking


the BlankOperation project in Visual studio and select Build.

j.

Once the build completed (Succeeded message will be displayed


in the visual studio output window), copy the BlankOperation.dll
assembly from C:\Users\...\Documents\Retail SDK\POS Plugins\Services\BlankOperations\Bin\Release to the Retail
Pos\Services\Extension folder. (This path is applicable for AX 2012
Retail R2 RTM only)

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

21 - 3

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization
2.

Add Blank Operation on the Retail POS register


a.

3.

i.

Operator Id: 000100

ii.

Password: 123

b.

If it is first time log on to POS, then POS will display the Shift
form, in that please click "Add a new Shift".

c.

After logging in right-click on the POS button grid area and


select Add row. After that a new row will be created with empty
buttons. Then right-click any empty button and select Button
Properties a new form will popup.

d.

In the Action drop-down list box, select Blank Operation. The


Operation number field is a string value that Retail POS uses to
identify your Blank Operation. Because you can send multiple
blank operations to Retail POS simultaneously, you must give
each one a unique identity for Retail POS to distinguish which
ones to execute.

e.

The Blank Operation param field enables you to send an optional


string parameter. The Operation number and Blank Operation
param values combine to form the method signature of your
Blank Operation. In this scenario, set the Operation number to
BingSearch and leave the Blank Operation param value.

Adding item to POS transaction


a.

21 - 4

Launch Retail POS by clicking the Retail POS on the start page,
and login to POS using the below operator id and password:

Add any item to POS by clicking the product search or Sales or


product sale or by entering/scanning the item barcode. If you
click sales button, categories of item will be displayed, in that
click any category and then click any item from that category.
The clicked item will be added to POS transaction and then click
the newly added blank operation button it should open the
internet explorer with Bing search web page and search text as
your item description.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 21: Extensibility Lab Manual


Results
Bing search result will be displayed in the internet explore with search text as item
description.

Exercise 2: Request for Loyalty card by using Triggers


Triggers are used to capture events that fire before and after Microsoft Dynamics
AX for Retail POS operations. You can insert custom logic before the operation
runs or after it has completed.

Exercise Scenario
We want to prompt the cashier for loyalty card request from the customer after
the first item added to transaction

Task 1: Item Trigger Extensibility


High Level Steps
1.

Perform loyalty prompt request.

Detailed Steps
1.

Perform loyalty prompt request.


a.

The lab exercise should be performed on the vm - AX2012R2Av2

b.

Open Retail POS Plug-ins from the folder where you installed the
Retail POS SDK. By default it will be C:\Users\...\Documents\Retail
SDK\POS Plug-ins\.For more information about how to install
Retail POS Plug-ins, see Install the Retail SDK.

c.

Open the Triggers folder and double-click the Triggers Visual


Studio solution file.

d.

Open the ItemTriggers project because all the item related


triggers operations are done in this project

e.

Please add reference to the following assemblies located in the


Retail POS runtime folder by right-clicking the itemtriggers
project and select Add Reference:
i.

DevExpress.Utils.v11.2.dll

ii.

POSProcesses.dll

iii. System.Windows.Forms.dll
iv. Microsoft.Dynamics.Retail.Pos.SystemCore
v.

Transaction

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

21 - 5

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization
f.

Right-click the ItemTriggers project and select properties. In the


properties windows click Build and set the Configuration to
Release and also change the build mode to Release from the drop
down menu in the visual studio menu bar.

g.

Select the ItemTriggers.cs file in ItemTriggers project and double


click the file.

h.

Add the following code below the namespace section to use the
referenced libraries as shown in the below code:

Namespace Microsoft.Dynamics.Retail.Pos.ItemTriggers
{
using System.Windows.Forms;
using Microsoft.Dynamics.Retail.Pos.SystemCore;
using LSRetailPosis.Transaction;
using LSRetailPosis.POSProcesses;

i.

Now we will add code in the PostSale() method in the


ItemTriggers,cs file. After the addition of every item this method
is called by the system. So we can add our custom code in this
method to prompt the operator for adding loyalty card.

j.

Copy the below code in the PostSale() method


In the below code we are checking the item count is 1 and
previously no loyalty card added then prompt the user for
adding loyalty card, if they click yes we will run the standard
loyalty request operation

RetailTransaction retailTransaction = posTransaction as


RetailTransaction;
if (retailTransaction != null &&
retailTransaction.SaleItems.Count == 1 &&
retailTransaction.LoyaltyItem.LoyaltyCardNumber == null)
{
using (frmMessage message = new frmMessage("Do you want to
add loyalty card to transaction?", MessageBoxButtons.YesNo,
MessageBoxIcon.Question))
{
DialogResult result = messgae.ShowDialog();
if (result == DialogResult.Yes)
{
PosApplication.Instance.RunOperation(Contracts.PosisOperations.LoyaltyRequ
est, null, posTransaction);
}
}
}

k.

21 - 6

After that compile and build the ItemTriggers project by right


clicking the ItemTriggers project in Visual studio and select Build.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 21: Extensibility Lab Manual


l.

Once the build completed (Succeeded message will be displayed


in the visual studio output window), copy the ItemTriggers.dll
assembly from C:\Users\...\Documents\Retail SDK\POS Plugins\Triggers\ItemTriggers\Bin\Release to the Retail
Pos\Services\Extension folder. (This path is applicable for AX 2012
Retail R2 RTM only)

m. Launch Retail POS by clicking the Retail POS on the start page,
and login to POS using the below operator id and password:
i.

Operator Id: 000100

ii.

Password: 123

n.

If it is first time log on to POS, then POS will display the Shift
form, in that please click "Add a new Shift".

o.

Add any item to POS by clicking the product search or Sales or


product sale or by entering/scanning the item barcode. If you
click sales button, categories of item will be displayed, in that
click any category and then click any item from that category.

p.

The system will prompt the operator for adding the loyalty card
to transaction.

Results
Popup will be shown to the POS operator for requesting loyalty card request.

Exercise 3: Adding manager approval to maximum line


discount amount
Exercise Scenario
Currently the maximum line discount amount doesnt have manger approval
functionality for giving the discount amount greater than what is defined in the
functionality profile, but in scenarios where the operator want to give more
discount is not possible. To avoid this we can make the POS to prompt for the
manger access to override the discount defined in the functionality profile.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

21 - 7

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization
Task 1: Override the discount amount defined in functionality profile
High Level Steps
1.

Prompt the user for manager credentials to override the discount


amount.

Detailed Steps
1.

Prompt the user for manager credentials to override the discount


amount.
a.

The lab exercise should be performed on the vm - AX2012R2Av2

b.

Open Retail POS Plug-ins from the folder where you installed the
Retail POS SDK. By default it will be C:\Users\...\Documents\Retail
SDK\POS Plug-ins\.For more information about how to install
Retail POS Plug-ins, see Install the Retail SDK.

c.

Open the Services folder and double-click the Services Visual


Studio solution file.

d.

Go to the Discount project and expand it.

e.

Right-click the Discount project and select properties. In the


properties windows click Build and set the Configuration to
Release and also change the build mode to Release from the drop
down menu in the visual studio menu bar.

f.

Please add reference to the following assemblies located in the


Retail POS runtime folder by right-clicking the Discount project
and select Add Reference from Retail POS folder:

g.

i.

Microsoft.Practices.Prism.Interactivity

ii.

Microsoft.Dynamics.Retail.Notification.Contracts

Open the Discount.cs file and add the below lines in the
namespace section as shown below:

namespace Microsoft.Dynamics.Retail.Pos.DiscountService

using Microsoft.Practices.Prism.Interactivity.InteractionRequest;
using Microsoft.Dynamics.Retail.Notification.Contracts;

h.

Locate the AuthorizeLineDiscountAmount() method in


Discount.cs file.
The logic that enforces the maximum line discount amount is
defined in this method.

21 - 8

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 21: Extensibility Lab Manual


i.

We will override this method to ask for the manger credential


and if success then we will allow the operator to give discount
greater than the maximum amount defined in functionality
profile.

j.

Clear all the code inside the AuthorizeLineDiscountAmount()


method

k.

Copy the below code and paste it in the


AuthorizeLineDiscountAmount() method.

bool returnValue = true;


decimal itemPriceWithoutDiscount = saleLineItem.Price *
saleLineItem.Quantity;
maximumDiscountAmt *= saleLineItem.Quantity;
if
(FiscalPrinter.FiscalPrinter.Instance.FiscalPrinterEnabled()
&&
!FiscalPrinter.FiscalPrinter.Instance.AuthorizeLineDiscountAmount(saleLine
Item, lineDiscountItem, maximumDiscountAmt))
{
returnValue = false;
}
else if (lineDiscountItem.Amount > itemPriceWithoutDiscount)
{
returnValue = false;
string message =
ApplicationLocalizer.Language.Translate(3177); //The discount amount is
too high. The discount amount cannot exceed the item price.
using (frmMessage dialog = new frmMessage(message,
MessageBoxButtons.OK, MessageBoxIcon.Information))
{
POSFormsManager.ShowPOSForm(dialog);
}
}
else if (lineDiscountItem.Amount > maximumDiscountAmt /
saleLineItem.Quantity)
{
returnValue = false;
string maximumAmountRounded =
this.Application.Services.Rounding.Round(maximumDiscountAmt, true);
decimal maximumDiscountPct = (itemPriceWithoutDiscount ==
decimal.Zero) ? decimal.Zero : (100m * maximumDiscountAmt /
itemPriceWithoutDiscount);
ManagerAccessConfirmation managerAccessInteraction = new
ManagerAccessConfirmation();
InteractionRequestedEventArgs request = new
InteractionRequestedEventArgs(managerAccessInteraction, () => { });
Application.Services.Interaction.InteractionRequest(request);
if
(managerAccessInteraction.Confirmed)
{
// Manager auth was successful
returnValue = true;
}
else
{
string message =
ApplicationLocalizer.Language.Translate(3173, maximumAmountRounded,

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

21 - 9

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization
maximumDiscountPct.ToString("n2")); //The discount amount is too high. The
discount percentage limit is set to xxxx %.
using (frmMessage dialog = new frmMessage(message,
MessageBoxButtons.OK, MessageBoxIcon.Information))
{
POSFormsManager.ShowPOSForm(dialog);
}
}
}
return returnValue;

If the discount amount is greater than maximum value we are asking for the
manager confirmation. If the confirmation is true then we are allowing for the
discount by passing the standard functionality.
l.

After that compile and build the Discount project by right


clicking the Discount project in Visual studio and select Build.

m. Once the build completed (Succeeded message will be displayed


in the visual studio output window), copy the Discount.dll
assembly from C:\Users\...\Documents\Retail SDK\POS Plugins\Services\Discount\Bin\Release to the Retail Pos\Services
folder. The system will pop up a message The destination already
has a file named Discount.dll. In that please click Replace the
file in the destination. (This path is applicable for AX 2012 Retail
R2 RTM only)
n.

21 - 10

Launch Retail POS by clicking the Retail POS on the start page,
and login to POS using the below operator id and password:
i.

Operator Id: 000100

ii.

Password: 123

o.

If it is first time log on to POS, then POS will display the Shift
form, in that please click "Add a new Shift".

p.

Add any item to POS by clicking the product search or Sales or


product sale or by entering/scanning the item barcode. If you
click sales button, categories of item will be displayed, in that
click any category and then click any item from that category.

q.

Next increase the item quantity such that the final price of the item is
greater than 9001. We can increase the quantity by clicking the
following buttons in the POS layout(Sales->Tasks->Edit line->Set
quantity)

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 21: Extensibility Lab Manual


r.

After that click the Discounts button and select the Line discount
amount and try to give discount amount of 9001 and click OK, next
system will ask for the manager log on information to authorize the
discount.

Use the below operator id and password:


i.

Operator Id: 000100

ii.

Password: 123

s.

Next system will pop up a reason code selection form, in that select
any reason code (The Reason code form will pop up only if it is
configured in HQ).

t.

If it is success then the system will give the discount else it will
through the error message.

Results
Overrides the maximum amount discount defined in the functionality profile.

Exercise 4: View Inventory status of the item across all


stores
Real-time Service enables retail clients to interact with Microsoft Dynamics AX
retail functionality in real time.

Exercise Scenario
The existing inventory status functionality will allow us to view the item status of
the stores which belong to the same legal entity. We will modify the query in retail
transaction service class to fetch the inventory status of items across all the legal
entities.

Task 1: Modify the RetailTransactionService class


High Level Steps
1.

Update inventoryLookup method to include item inventory status


across all the stores

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

21 - 11

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization
Detailed Steps
1.

Update inventoryLookup method to include item inventory status


across all the stores
a.

The lab exercise should be performed on the vm - AX2012R2Av2

b.

Open AX from the Desktop icon and then click Ctrl+D to open
development workspace

c.

In the AOT, Go to classes and expand it.

d.

Select RetailTransactionService, class and point to


inventoryLookup method

e.

Open the inventoryLookup method by double clicking it

f.

In this method we will modify the query to search across all legal
entities by including the cross company query and Change
company functionality to fetch across all legal entities.

g.

Comment the existing inventoryLookup code and Copy the below


code and paste it the inventoryLookup method.

RetailTransactionService transactionService = new


RetailTransactionService();
InventDimCombination
inventDimCombination =
InventDimCombination::findVariantId(_variantId);
InventDim
inventDim;
InventDimParm
inventDimParm;
InventOnhand
inventOnhand;
RetailStoreTable
retailStoreTable;
RetailChannelTable
retailChannelTable;
DirPartyTable
dirPartyTable;
container
InventLocation
InventQty

output = [true,''];
inventLocation;
availPhysical;

try
{
//New line added for Extending
while select crossCompany InventLocation from retailStoreTable
join omOperatingUnitID from retailChannelTable
where retailChannelTable.RecId == retailStoreTable.RecId
join Name from dirPartyTable
where dirPartyTable.RecId ==
retailChannelTable.omOperatingUnitID
join InventSiteId, InventLocationId from inventLocation
where inventLocation.InventLocationId ==
retailStoreTable.InventLocation
{
inventDim.InventSizeId
=
inventDimCombination.inventDim().InventSizeId;
inventDim.InventColorId
=
inventDimCombination.inventDim().InventColorId;
inventDim.InventStyleId
=
inventDimCombination.inventDim().InventStyleId;
inventDim.ConfigId
=
inventDimCombination.inventDim().ConfigId;

21 - 12

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Module 21: Extensibility Lab Manual


inventDim.InventSiteId
= inventLocation.InventSiteId;
inventDim.InventLocationId = inventLocation.InventLocationId;
//New line added for Extending
changeCompany(inventLocation.dataAreaId)
{
inventDim = InventDim::findDim(inventDim);
if (inventDim.RecId)
{
inventDimParm.initFromInventDim(inventDim);
inventOnhand =
InventOnhand::newItemDim(_itemId,inventDim,inventDimParm);
availPhysical = inventOnhand.availPhysical();
output = conIns(output,conLen(output)+1, _itemId,
inventLocation.InventLocationId, dirPartyTable.Name, availPhysical);
}
}
}
}
catch
{
RetailTracer::Error('RetailTransactionService', funcName(), 'An
error has occcured.');
throw error("@RET2382");
}
return output;

h.

Compile the method by clicking F7 or compile icon in the tab.

i.

Launch Retail POS by clicking the Retail POS on the start page,
and login to POS using the below operator id and password:
i.

Operator Id: 000100

ii.

Password: 123

j.

If it is first time log on to POS, then POS will display the Shift
form, in that please click "Add a new Shift".

k.

After logging in right-click on the POS button grid area and


select Add row. After that a new row will be created with empty
buttons. Then right-click any empty button and select Button
Properties a new form will popup.

l.

In the Action drop-down list box, select Inventory lookup and


click OK.

m. After that click the newly added inventory lookup button.


n.

The system will display the inventory status across all legal
entities.

Results
View the inventory status across all the stores.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

21 - 13

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

21 - 14

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

INTRODUCTION
Training is an important component of maintaining the value of a Microsoft
Dynamics investment. Quality training from industry experts keeps you up-todate and helps you develop the skills necessary for fully maximizing the value of
your solution. Microsoft Dynamics provides different kinds of training to meet
everyones needs, from online training, classroom training, or training materials.
Select the training type that will best help you stay ahead of the competition.

Online Training
Online training delivers convenient, detailed training in the comfort of your own
home or office. Online training provides immediate access to training 24 hours a
day. It is perfect for the customer who does not have the time or budget to travel.
Online training options combine the efficiency of online training with the
thorough product coverage of classroom training.

Classroom Training
Classroom training provides, comprehensive learning through hands-on
interaction. From demonstrations to presentations to classroom activities, you
receive practical experience with instruction from our certified staff of experts.

Training Materials
Training materials help you learn at your own pace, in your own time, with
information-packed training manuals. The many training manuals features many
tips, tricks, and insights that you can reference continuously.

Microsoft Dynamics Courseware


The Microsoft Dynamics courseware consists of detailed training manuals that are
designed from a training perspective. These manuals include advanced topics, in
addition to training objectives, exercises, interactions, and quizzes.
Look for a complete list of manuals that are available for purchase on
CustomerSource or PartnerSource.

0-1
Microsoft Official Training Materials for Microsoft Dynamics
Your use of this content is subject to your current services agreement

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

Microsoft Dynamics Courseware Contents


Microsoft Dynamics courseware contains labs and quick interactions. These help
improve your learning experience through practical application.

Lab
Within the Microsoft Dynamics training materials, you will find labs. These labs are
typically offered in two levels to accommodate each students variety of
knowledge and expertise. We suggest that you try the High level steps first. If you
need help completing the task, look to the information in the Detailed steps.

High level steps


High levels steps are the most challenging. These steps are designed for the
experienced student who requires little instruction to complete the required task.

Detailed steps
Detailed steps are geared toward new users who require detailed instructions and
explanations to complete the lab. Detailed steps guide you through the whole
task. This includes navigation.

0-2

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Introduction

Student Objectives
What do you hope to learn by participating in this course?
List three main objectives here.
1.

2.

3.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

0-3

Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization

0-4

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement