Sie sind auf Seite 1von 184

Course 80638:

MICROSOFT DYNAMICS AX 2012 R3 FOR RETAIL IN


BRICK AND MORTAR STORES: DEVELOPMENT AND
CUSTOMIZATION
This courseware is provided “as-is”. Information and views expressed in this courseware, including URL and
other Internet Web site references, may change without notice.

Unless otherwise noted, the examples depicted herein are provided for illustration only and are fictitious. No
real association or connection is intended or should be inferred.

This courseware does not provide you with any legal rights to any intellectual property in any Microsoft
product. Complying with all applicable copyright laws is the responsibility of the user. Without limiting the
rights under copyright, no part of this courseware may be reproduced, stored in or introduced into a retrieval
system, or transmitted in any form or by any means or for any purpose, without the express written
permission of Microsoft Corporation.

Copyright © 2012 Microsoft Corporation. All rights reserved.

Microsoft®, Microsoft Dynamics®, Microsoft® PowerPoint®, Microsoft® SQL Server® data management
software and Microsoft Dynamics® NAV are trademarks of the Microsoft group of companies. All other
trademarks are property of their respective owners.
MICROSOFT LICENSE TERMS
MICROSOFT INSTRUCTOR-LED COURSEWARE

These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its
affiliates) and you. Please read them. They apply to your use of the content accompanying this agreement which
includes the media on which you received it, if any. These license terms also apply to Trainer Content and any
updates and supplements for the Licensed Content unless other terms accompany those items. If so, those terms
apply.

BY ACCESSING, DOWNLOADING OR USING THE LICENSED CONTENT, YOU ACCEPT THESE TERMS.
IF YOU DO NOT ACCEPT THEM, DO NOT ACCESS, DOWNLOAD OR USE THE LICENSED CONTENT.

If you comply with these license terms, you have the rights below for each license you acquire.

1. DEFINITIONS.

a. “Authorized Learning Center” means a Microsoft IT Academy Program Member, Microsoft Learning
Competency Member, or such other entity as Microsoft may designate from time to time.

b. “Authorized Training Session” means the instructor-led training class using Microsoft Instructor-Led
Courseware conducted by a Trainer at or through an Authorized Learning Center.

c. “Classroom Device” means one (1) dedicated, secure computer that an Authorized Learning Center owns
or controls that is located at an Authorized Learning Center’s training facilities that meets or exceeds the
hardware level specified for the particular Microsoft Instructor-Led Courseware.

d. “End User” means an individual who is (i) duly enrolled in and attending an Authorized Training Session
or Private Training Session, (ii) an employee of a MPN Member, or (iii) a Microsoft full-time employee.

e. “Licensed Content” means the content accompanying this agreement which may include the Microsoft
Instructor-Led Courseware or Trainer Content.

f. “Microsoft Certified Trainer” or “MCT” means an individual who is (i) engaged to teach a training session
to End Users on behalf of an Authorized Learning Center or MPN Member, and (ii) currently certified as a
Microsoft Certified Trainer under the Microsoft Certification Program.

g. “Microsoft Instructor-Led Courseware” means the Microsoft-branded instructor-led training course that
educates IT professionals and developers on Microsoft technologies. A Microsoft Instructor-Led
Courseware title may be branded as MOC, Microsoft Dynamics or Microsoft Business Group courseware.

h. “Microsoft IT Academy Program Member” means an active member of the Microsoft IT Academy
Program.

i. “Microsoft Learning Competency Member” means an active member of the Microsoft Partner Network
program in good standing that currently holds the Learning Competency status.

j. “MOC” means the “Official Microsoft Learning Product” instructor-led courseware known as Microsoft
Official Course that educates IT professionals and developers on Microsoft technologies.

k. “MPN Member” means an active silver or gold-level Microsoft Partner Network program member in good
standing.
l. “Personal Device” means one (1) personal computer, device, workstation or other digital electronic device
that you personally own or control that meets or exceeds the hardware level specified for the particular
Microsoft Instructor-Led Courseware.

m. “Private Training Session” means the instructor-led training classes provided by MPN Members for
corporate customers to teach a predefined learning objective using Microsoft Instructor-Led Courseware.
These classes are not advertised or promoted to the general public and class attendance is restricted to
individuals employed by or contracted by the corporate customer.

n. “Trainer” means (i) an academically accredited educator engaged by a Microsoft IT Academy Program
Member to teach an Authorized Training Session, and/or (ii) a MCT.

o. “Trainer Content” means the trainer version of the Microsoft Instructor-Led Courseware and additional
supplemental content designated solely for Trainers’ use to teach a training session using the Microsoft
Instructor-Led Courseware. Trainer Content may include Microsoft PowerPoint presentations, trainer
preparation guide, train the trainer materials, Microsoft One Note packs, classroom setup guide and Pre-
release course feedback form. To clarify, Trainer Content does not include any software, virtual hard
disks or virtual machines.

2. USE RIGHTS. The Licensed Content is licensed not sold. The Licensed Content is licensed on a one copy
per user basis, such that you must acquire a license for each individual that accesses or uses the Licensed
Content.

2.1 Below are five separate sets of use rights. Only one set of rights apply to you.

a. If you are a Microsoft IT Academy Program Member:


i. Each license acquired on behalf of yourself may only be used to review one (1) copy of the Microsoft
Instructor-Led Courseware in the form provided to you. If the Microsoft Instructor-Led Courseware is
in digital format, you may install one (1) copy on up to three (3) Personal Devices. You may not
install the Microsoft Instructor-Led Courseware on a device you do not own or control.
ii. For each license you acquire on behalf of an End User or Trainer, you may either:
1. distribute one (1) hard copy version of the Microsoft Instructor-Led Courseware to one (1) End
User who is enrolled in the Authorized Training Session, and only immediately prior to the
commencement of the Authorized Training Session that is the subject matter of the Microsoft
Instructor-Led Courseware being provided, or
2. provide one (1) End User with the unique redemption code and instructions on how they can
access one (1) digital version of the Microsoft Instructor-Led Courseware, or
3. provide one (1) Trainer with the unique redemption code and instructions on how they can
access one (1) Trainer Content,
provided you comply with the following:
iii. you will only provide access to the Licensed Content to those individuals who have acquired a valid
license to the Licensed Content,
iv. you will ensure each End User attending an Authorized Training Session has their own valid licensed
copy of the Microsoft Instructor-Led Courseware that is the subject of the Authorized Training
Session,
v. you will ensure that each End User provided with the hard-copy version of the Microsoft Instructor-
Led Courseware will be presented with a copy of this agreement and each End User will agree that
their use of the Microsoft Instructor-Led Courseware will be subject to the terms in this agreement
prior to providing them with the Microsoft Instructor-Led Courseware. Each individual will be required
to denote their acceptance of this agreement in a manner that is enforceable under local law prior to
their accessing the Microsoft Instructor-Led Courseware,
vi. you will ensure that each Trainer teaching an Authorized Training Session has their own valid
licensed copy of the Trainer Content that is the subject of the Authorized Training Session,
vii. you will only use qualified Trainers who have in-depth knowledge of and experience with the
Microsoft technology that is the subject of the Microsoft Instructor-Led Courseware being taught for
all your Authorized Training Sessions,
viii. you will only deliver a maximum of 15 hours of training per week for each Authorized Training
Session that uses a MOC title, and
ix. you acknowledge that Trainers that are not MCTs will not have access to all of the trainer resources
for the Microsoft Instructor-Led Courseware.

b. If you are a Microsoft Learning Competency Member:


i. Each license acquired on behalf of yourself may only be used to review one (1) copy of the Microsoft
Instructor-Led Courseware in the form provided to you. If the Microsoft Instructor-Led Courseware is
in digital format, you may install one (1) copy on up to three (3) Personal Devices. You may not
install the Microsoft Instructor-Led Courseware on a device you do not own or control.
ii. For each license you acquire on behalf of an End User or Trainer, you may either:
1. distribute one (1) hard copy version of the Microsoft Instructor-Led Courseware to one (1) End
User attending the Authorized Training Session and only immediately prior to the
commencement of the Authorized Training Session that is the subject matter of the Microsoft
Instructor-Led Courseware provided, or
2. provide one (1) End User attending the Authorized Training Session with the unique redemption
code and instructions on how they can access one (1) digital version of the Microsoft Instructor-
Led Courseware, or
3. you will provide one (1) Trainer with the unique redemption code and instructions on how they
can access one (1) Trainer Content,
provided you comply with the following:
iii. you will only provide access to the Licensed Content to those individuals who have acquired a valid
license to the Licensed Content,
iv. you will ensure that each End User attending an Authorized Training Session has their own valid
licensed copy of the Microsoft Instructor-Led Courseware that is the subject of the Authorized
Training Session,
v. you will ensure that each End User provided with a hard-copy version of the Microsoft Instructor-Led
Courseware will be presented with a copy of this agreement and each End User will agree that their
use of the Microsoft Instructor-Led Courseware will be subject to the terms in this agreement prior to
providing them with the Microsoft Instructor-Led Courseware. Each individual will be required to
denote their acceptance of this agreement in a manner that is enforceable under local law prior to
their accessing the Microsoft Instructor-Led Courseware,
vi. you will ensure that each Trainer teaching an Authorized Training Session has their own valid
licensed copy of the Trainer Content that is the subject of the Authorized Training Session,
vii. you will only use qualified Trainers who hold the applicable Microsoft Certification credential that is
the subject of the Microsoft Instructor-Led Courseware being taught for your Authorized Training
Sessions,
viii. you will only use qualified MCTs who also hold the applicable Microsoft Certification credential that is
the subject of the MOC title being taught for all your Authorized Training Sessions using MOC,
ix. you will only provide access to the Microsoft Instructor-Led Courseware to End Users, and
x. you will only provide access to the Trainer Content to Trainers.
c. If you are a MPN Member:
i. Each license acquired on behalf of yourself may only be used to review one (1) copy of the Microsoft
Instructor-Led Courseware in the form provided to you. If the Microsoft Instructor-Led Courseware is
in digital format, you may install one (1) copy on up to three (3) Personal Devices. You may not
install the Microsoft Instructor-Led Courseware on a device you do not own or control.
ii. For each license you acquire on behalf of an End User or Trainer, you may either:
1. distribute one (1) hard copy version of the Microsoft Instructor-Led Courseware to one (1) End
User attending the Private Training Session, and only immediately prior to the commencement
of the Private Training Session that is the subject matter of the Microsoft Instructor-Led
Courseware being provided, or
2. provide one (1) End User who is attending the Private Training Session with the unique
redemption code and instructions on how they can access one (1) digital version of the
Microsoft Instructor-Led Courseware, or
3. you will provide one (1) Trainer who is teaching the Private Training Session with the unique
redemption code and instructions on how they can access one (1) Trainer Content,
provided you comply with the following:
iii. you will only provide access to the Licensed Content to those individuals who have acquired a valid
license to the Licensed Content,
iv. you will ensure that each End User attending an Private Training Session has their own valid licensed
copy of the Microsoft Instructor-Led Courseware that is the subject of the Private Training Session,
v. you will ensure that each End User provided with a hard copy version of the Microsoft Instructor-Led
Courseware will be presented with a copy of this agreement and each End User will agree that their
use of the Microsoft Instructor-Led Courseware will be subject to the terms in this agreement prior to
providing them with the Microsoft Instructor-Led Courseware. Each individual will be required to
denote their acceptance of this agreement in a manner that is enforceable under local law prior to
their accessing the Microsoft Instructor-Led Courseware,
vi. you will ensure that each Trainer teaching an Private Training Session has their own valid licensed
copy of the Trainer Content that is the subject of the Private Training Session,
vii. you will only use qualified Trainers who hold the applicable Microsoft Certification credential that is
the subject of the Microsoft Instructor-Led Courseware being taught for all your Private Training
Sessions,
viii. you will only use qualified MCTs who hold the applicable Microsoft Certification credential that is the
subject of the MOC title being taught for all your Private Training Sessions using MOC,
ix. you will only provide access to the Microsoft Instructor-Led Courseware to End Users, and
x. you will only provide access to the Trainer Content to Trainers.

d. If you are an End User:


For each license you acquire, you may use the Microsoft Instructor-Led Courseware solely for your
personal training use. If the Microsoft Instructor-Led Courseware is in digital format, you may access the
Microsoft Instructor-Led Courseware online using the unique redemption code provided to you by the
training provider and install and use one (1) copy of the Microsoft Instructor-Led Courseware on up to
three (3) Personal Devices. You may also print one (1) copy of the Microsoft Instructor-Led Courseware.
You may not install the Microsoft Instructor-Led Courseware on a device you do not own or control.

e. If you are a Trainer.


i. For each license you acquire, you may install and use one (1) copy of the Trainer Content in the
form provided to you on one (1) Personal Device solely to prepare and deliver an Authorized
Training Session or Private Training Session, and install one (1) additional copy on another Personal
Device as a backup copy, which may be used only to reinstall the Trainer Content. You may not
install or use a copy of the Trainer Content on a device you do not own or control. You may also
print one (1) copy of the Trainer Content solely to prepare for and deliver an Authorized Training
Session or Private Training Session.
ii. You may customize the written portions of the Trainer Content that are logically associated with
instruction of a training session in accordance with the most recent version of the MCT agreement.
If you elect to exercise the foregoing rights, you agree to comply with the following: (i)
customizations may only be used for teaching Authorized Training Sessions and Private Training
Sessions, and (ii) all customizations will comply with this agreement. For clarity, any use of
“customize” refers only to changing the order of slides and content, and/or not using all the slides or
content, it does not mean changing or modifying any slide or content.

2.2 Separation of Components. The Licensed Content is licensed as a single unit and you may not
separate their components and install them on different devices.

2.3 Redistribution of Licensed Content. Except as expressly provided in the use rights above, you may
not distribute any Licensed Content or any portion thereof (including any permitted modifications) to any
third parties without the express written permission of Microsoft.

2.4 Third Party Programs and Services. The Licensed Content may contain third party programs or
services. These license terms will apply to your use of those third party programs or services, unless other
terms accompany those programs and services.

2.5 Additional Terms. Some Licensed Content may contain components with additional terms,
conditions, and licenses regarding its use. Any non-conflicting terms in those conditions and licenses also
apply to your use of that respective component and supplements the terms described in this agreement.

3. LICENSED CONTENT BASED ON PRE-RELEASE TECHNOLOGY. If the Licensed Content’s subject


matter is based on a pre-release version of Microsoft technology (“Pre-release”), then in addition to the
other provisions in this agreement, these terms also apply:

a. Pre-Release Licensed Content. This Licensed Content subject matter is on the Pre-release version of
the Microsoft technology. The technology may not work the way a final version of the technology will
and we may change the technology for the final version. We also may not release a final version.
Licensed Content based on the final version of the technology may not contain the same information as
the Licensed Content based on the Pre-release version. Microsoft is under no obligation to provide you
with any further content, including any Licensed Content based on the final version of the technology.

b. Feedback. If you agree to give feedback about the Licensed Content to Microsoft, either directly or
through its third party designee, you give to Microsoft without charge, the right to use, share and
commercialize your feedback in any way and for any purpose. You also give to third parties, without
charge, any patent rights needed for their products, technologies and services to use or interface with
any specific parts of a Microsoft software, Microsoft product, or service that includes the feedback. You
will not give feedback that is subject to a license that requires Microsoft to license its software,
technologies, or products to third parties because we include your feedback in them. These rights
survive this agreement.

c. Pre-release Term. If you are an Microsoft IT Academy Program Member, Microsoft Learning
Competency Member, MPN Member or Trainer, you will cease using all copies of the Licensed Content on
the Pre-release technology upon (i) the date which Microsoft informs you is the end date for using the
Licensed Content on the Pre-release technology, or (ii) sixty (60) days after the commercial release of the
technology that is the subject of the Licensed Content, whichever is earliest (“Pre-release term”).
Upon expiration or termination of the Pre-release term, you will irretrievably delete and destroy all copies
of the Licensed Content in your possession or under your control.
4. SCOPE OF LICENSE. The Licensed Content is licensed, not sold. This agreement only gives you some
rights to use the Licensed Content. Microsoft reserves all other rights. Unless applicable law gives you more
rights despite this limitation, you may use the Licensed Content only as expressly permitted in this
agreement. In doing so, you must comply with any technical limitations in the Licensed Content that only
allows you to use it in certain ways. Except as expressly permitted in this agreement, you may not:
 access or allow any individual to access the Licensed Content if they have not acquired a valid license
for the Licensed Content,
 alter, remove or obscure any copyright or other protective notices (including watermarks), branding
or identifications contained in the Licensed Content,
 modify or create a derivative work of any Licensed Content,
 publicly display, or make the Licensed Content available for others to access or use,
 copy, print, install, sell, publish, transmit, lend, adapt, reuse, link to or post, make available or
distribute the Licensed Content to any third party,
 work around any technical limitations in the Licensed Content, or
 reverse engineer, decompile, remove or otherwise thwart any protections or disassemble the
Licensed Content except and only to the extent that applicable law expressly permits, despite this
limitation.

5. RESERVATION OF RIGHTS AND OWNERSHIP. Microsoft reserves all rights not expressly granted to
you in this agreement. The Licensed Content is protected by copyright and other intellectual property laws
and treaties. Microsoft or its suppliers own the title, copyright, and other intellectual property rights in the
Licensed Content.

6. EXPORT RESTRICTIONS. The Licensed Content is subject to United States export laws and regulations.
You must comply with all domestic and international export laws and regulations that apply to the Licensed
Content. These laws include restrictions on destinations, end users and end use. For additional information,
see www.microsoft.com/exporting.

7. SUPPORT SERVICES. Because the Licensed Content is “as is”, we may not provide support services for it.

8. TERMINATION. Without prejudice to any other rights, Microsoft may terminate this agreement if you fail
to comply with the terms and conditions of this agreement. Upon termination of this agreement for any
reason, you will immediately stop all use of and delete and destroy all copies of the Licensed Content in
your possession or under your control.

9. LINKS TO THIRD PARTY SITES. You may link to third party sites through the use of the Licensed
Content. The third party sites are not under the control of Microsoft, and Microsoft is not responsible for
the contents of any third party sites, any links contained in third party sites, or any changes or updates to
third party sites. Microsoft is not responsible for webcasting or any other form of transmission received
from any third party sites. Microsoft is providing these links to third party sites to you only as a
convenience, and the inclusion of any link does not imply an endorsement by Microsoft of the third party
site.

10. ENTIRE AGREEMENT. This agreement, and any additional terms for the Trainer Content, updates and
supplements are the entire agreement for the Licensed Content, updates and supplements.

11. APPLICABLE LAW.


a. United States. If you acquired the Licensed Content in the United States, Washington state law governs
the interpretation of this agreement and applies to claims for breach of it, regardless of conflict of laws
principles. The laws of the state where you live govern all other claims, including claims under state
consumer protection laws, unfair competition laws, and in tort.
b. Outside the United States. If you acquired the Licensed Content in any other country, the laws of that
country apply.

12. LEGAL EFFECT. This agreement describes certain legal rights. You may have other rights under the laws
of your country. You may also have rights with respect to the party from whom you acquired the Licensed
Content. This agreement does not change your rights under the laws of your country if the laws of your
country do not permit it to do so.

13. DISCLAIMER OF WARRANTY. THE LICENSED CONTENT IS LICENSED "AS-IS" AND "AS
AVAILABLE." YOU BEAR THE RISK OF USING IT. MICROSOFT AND ITS RESPECTIVE
AFFILIATES GIVES NO EXPRESS WARRANTIES, GUARANTEES, OR CONDITIONS. YOU MAY
HAVE ADDITIONAL CONSUMER RIGHTS UNDER YOUR LOCAL LAWS WHICH THIS AGREEMENT
CANNOT CHANGE. TO THE EXTENT PERMITTED UNDER YOUR LOCAL LAWS, MICROSOFT AND
ITS RESPECTIVE AFFILIATES EXCLUDES ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.

14. LIMITATION ON AND EXCLUSION OF REMEDIES AND DAMAGES. YOU CAN RECOVER FROM
MICROSOFT, ITS RESPECTIVE AFFILIATES AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP
TO US$5.00. YOU CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL,
LOST PROFITS, SPECIAL, INDIRECT OR INCIDENTAL DAMAGES.

This limitation applies to


o anything related to the Licensed Content, services, content (including code) on third party Internet
sites or third-party programs; and
o claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence,
or other tort to the extent permitted by applicable law.

It also applies even if Microsoft knew or should have known about the possibility of the damages. The
above limitation or exclusion may not apply to you because your country may not allow the exclusion or
limitation of incidental, consequential or other damages.

Please note: As this Licensed Content is distributed in Quebec, Canada, some of the clauses in this
agreement are provided below in French.

Remarque : Ce le contenu sous licence étant distribué au Québec, Canada, certaines des clauses
dans ce contrat sont fournies ci-dessous en français.

EXONÉRATION DE GARANTIE. Le contenu sous licence visé par une licence est offert « tel quel ». Toute
utilisation de ce contenu sous licence est à votre seule risque et péril. Microsoft n’accorde aucune autre garantie
expresse. Vous pouvez bénéficier de droits additionnels en vertu du droit local sur la protection dues
consommateurs, que ce contrat ne peut modifier. La ou elles sont permises par le droit locale, les garanties
implicites de qualité marchande, d’adéquation à un usage particulier et d’absence de contrefaçon sont exclues.

LIMITATION DES DOMMAGES-INTÉRÊTS ET EXCLUSION DE RESPONSABILITÉ POUR LES


DOMMAGES. Vous pouvez obtenir de Microsoft et de ses fournisseurs une indemnisation en cas de dommages
directs uniquement à hauteur de 5,00 $ US. Vous ne pouvez prétendre à aucune indemnisation pour les autres
dommages, y compris les dommages spéciaux, indirects ou accessoires et pertes de bénéfices.
Cette limitation concerne:
 tout ce qui est relié au le contenu sous licence, aux services ou au contenu (y compris le code)
figurant sur des sites Internet tiers ou dans des programmes tiers; et.
 les réclamations au titre de violation de contrat ou de garantie, ou au titre de responsabilité
stricte, de négligence ou d’une autre faute dans la limite autorisée par la loi en vigueur.
Elle s’applique également, même si Microsoft connaissait ou devrait connaître l’éventualité d’un tel dommage. Si
votre pays n’autorise pas l’exclusion ou la limitation de responsabilité pour les dommages indirects, accessoires
ou de quelque nature que ce soit, il se peut que la limitation ou l’exclusion ci-dessus ne s’appliquera pas à votre
égard.

EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous pourriez avoir d’autres droits
prévus par les lois de votre pays. Le présent contrat ne modifie pas les droits que vous confèrent les lois de votre
pays si celles-ci ne le permettent pas.

Revised September 2012


MODULE 1: INTRODUCTION TO RETAIL POINT OF
SALE (POS) AND OVERVIEW

Module Overview
Microsoft Dynamics AX 2012 R3 for Retail supports multiple retail channels. Retail
channels include online stores, online marketplaces, and brick-and-mortar stores.
In Retail, a brick-and-mortar store is called a “retail store.”

Objectives

 Introduction
 Course objectives
 Prerequisites
 Technical overview

INTRODUCTION
Training is an important component of maintaining the value of a Microsoft
Dynamics® investment. Quality training from industry experts keeps you up-to-
date and helps you develop the skills necessary for fully maximizing the value of
your solution. Microsoft Dynamics provides different kinds of training to meet
everyone’s 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.

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 student’s 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.
Student Objectives
What do you hope to learn by participating in this course?

List three main objectives here.

1.

2.

3.
Course Objectives
The main objective of this course on Microsoft Dynamics AX 2012 R3 for Retail in Brick and Mortar Stores
Customization and Extensibility is to understand the following:

1. Introduction to Retail Point of Sale and Overview


a. Introduction
b. Course objectives
c. Prerequisites
d. Retail POS overview
2. Retail POS Extensibility Technical Overview
3. Install Retail POS
a. Customizing Retail POS Themes
 POS Skins
 Creating New Skins
 Set Color Properties
b. User Interface Extensibility
 How to modify a form in Retail POS
c. Trigger Extensibility
 How to modify the trigger project
d. Services Extensibility
 How to modify the services project
e. Blank Operations Extensibility
 Setup a blank operation
 Add custom logic to the blank operation
f. Custom Fields on POS Layouts
g. Real Time Service Extensibility
 Extending the RetailTransactionServiceEx Class
h. POS Database Tool Extensibility
i. POS Payment Connector
4. Extending Retail Modern POS
a. Architecture of Retail Modern POS
b. Retail Modern POS Customization and Extensibility

5. Extensibility Testing Considerations


6. Extensibility Deployment and Hotfix update considerations
The course also contains labs on extending Retail POS and Modern POS.
Point of Sale (POS) Overview

Microsoft Dynamics AX for Retail POS is the point of sale (POS) program for
Microsoft Dynamics AX.

Microsoft Dynamics AX Retail POS is a solution that brings speed, power,


flexibility, dependability, and ease of use to the point-of-sale.

A Retail Brick and Mortar Store implementing AX 2012 R3 can use two types of
POS

 Retail POS - Fixed POS Terminal that uses a Windows Forms based touch
User Interface (UI).
 Modern POS - Windows 8 based POS that is created by using HTML5
development.

Tasks are performed by using a POS register and the graphical UI. Both are easy
to use and can be set up to meet the requirements of many industries, such as
grocery, fashion and specialty retailers.

Lesson Objectives

Discuss the Microsoft Dynamics POS Overview.


Retail POS

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.

Modern POS

Microsoft Dynamics AX 2012 R3 includes Modern POS, a point-of-sale app for


PCs, tablets, and phones. Sales staff can process sales transactions, customer
orders, and perform daily operations and inventory management with mobile
devices anywhere in the store, as well as at PC-based registers.

The Modern POS app running on a device is a thin client. It must connect to
Microsoft Dynamics AX Retail Server. Retail Server performs the business logic and
processing for Modern POS.

Modern POS is a smaller POS installation that is primarily designed for Windows 8.
Modern POS mostly uses Retail Server for the Master data and RTS for calls.

Disclaimer: The Retail Modern POS is comprised of pre-release components. All


pre-release features and functionality are preliminary based on current
expectations, and are subject to change without notice.
Microsoft Dynamics Retail Components

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

 Commerce Data Exchange: Async Server


 Commerce Data Exchange: Real time service
 Store and offline database

Microsoft Dynamics AX for Retail Async Server

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

Microsoft Dynamics AX for Retail Real time Service

Together with Async Server and Retail Scheduler, real-time service completes the
communications mechanism of Microsoft Dynamics AX for Retail. Real time
service provides 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 headquarters office and the stores, and more.

Channel Database

Each store must have its’ own database, and a single database is used for multiple
registers, this is known as the channel Database. 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 store’s 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.
Module Review
Module Review and Takeaways

 How does Enterprise work and key component of Enterprise POS.


 What is Real Time Service and how it is used POS.
 How POS Data is synchronized and What is Offline Database
 What is Modern POS

Test Your Knowledge

Test your knowledge with the following questions.

1. What is Channel Database?

2. What is Offline Database?

3. Can an offline database be shared across multiple terminals?

4. Describe any two operations that cannot be performed when the POS store
database is offline.
Test Your Knowledge Solutions
MODEL ANSWER:

7. Each store must have its’ own database, and a single database is used
for multiple registers, this is known as the channel Database.
8. An offline database helps make sure that the store’s 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.
9. No. Only the store database can be shared across multiple terminals.
10. Close a shift and print a Z-report.
MODULE 2: RETAIL POS EXTENSIBILITY TECHNICAL
OVERVIEW

Overview
This module discusses the Microsoft Dynamics AX 2012 POS extensibility and its
operations. This includes information on the following:

 Retail POS
 Modern POS (MPOS)

Note: The Retail Modern POS is comprised of pre-release components. All pre-
release features and functionality are preliminary based on current expectations,
and are subject to change without notice.

Objectives

Describe the technical framework and capabilities of Retail POS and Modern POS.
Retail POS
Capabilities

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.

When the store database is offline, the following operations cannot be performed:

 Print the X-report


 Print the Z-report
 Close a shift
 Blind-close a shift
 View blind-closed shifts
 Suspend a shift, plus more
When the connectivity to HQ is not working (CDX: Real time service connection
down), the following operations cannot be performed:

a. Inventory Lookup
b. Gift Card Operations
c. Loyalty Operations
d. Customer Order Operations, plus more

Framework and Extensibility

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

Customize or extend Microsoft Dynamics AX 2012 Retail 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,
and includes the following 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 (http://technet.microsoft.com/en-
us/library/hh771575.aspx )
 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.
 POS Clients – Contains the code for the Windows Modern Point of
Sale Application and Windows Phone Point of Sale Application,
together with native code for Peripherals.
 Hardware Station – Contains the code for Hardware Station service
that enables you to customize the possibilities of the hardware
station.
 Online Channel – Contains the code that you can use to extend the
data flow between online retail channels like e-commerce.

Retail POS Plug-ins

Retail POS Plug-ins contains a 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.
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


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

The folder contains two Visual Studio solutions—one 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
Operations

An operation is an activity that occurs in Retail POS. Operations can be a single


step or multiple steps. 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/en-
us/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 implements an interface. The developer can make
partial or full modifications to the service’s project. Microsoft Dynamics AX 2012 is
sent out with a collection of core services that can be customized or replaced by
using Retail POS Plug-ins. For descriptions of all the services interfaces that are
available in Retail POS, refer to “Interfaces for Services."(
http://msdn.microsoft.com/en-
us/library/microsoft.dynamics.retail.pos.contracts.services.aspx )

Triggers

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

 Pre-triggers
 Post-triggers

Refer to the POS Framework course document for more information.

Interface for Triggers

Similar to services, triggers also implement unique interfaces. The developer can
use triggers to perform pre-validations and post validations. Each trigger interface
has a set of methods that can be extended by the developers for customization.
Pre-triggers provide another 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”.( http://msdn.microsoft.com/en-
us/library/microsoft.dynamics.retail.pos.contracts.triggers.aspx )
Technical Background of Retail POS
Retail POS is a Windows Forms based solution that is designed to include
extensibility. It uses the Microsoft MEF framework to manage dependency
injection and provide Inversion of control through which extensibility is
performed.

Retail POS uses Microsoft Synch framework for Synching Offline Database and
Channel Database.

Development Requirements
Some development requirements for Retail POS include the following:

 Knowledge of C# and .net


 Visual Studio experience
 Knowledge of Windows Forms development
 How to read, understand and write OOPS based applications

Modern POS
Capabilities

Modern POS includes the following capabilities:

 Supports most of the capabilities that are provided by Retail POS except
for the limitations of hardware capabilities to interact with Windows 8
Framework.
 There is no offline capability and uses RTS for order creation.
 Supports the hardware station feature that can be used to remote print
and uses hardware that is not attached directly to the POS computer.
Framework and Extensibility

Figure 2-1 : Modern POS Architecture

Source Code

Unlike Retail POS, the complete Source code for Modern POS is available with
Retail SDK. This lets you customize Modern POS.

Open Framework

Information about the open framework includes the following:

 Modern POS uses the Rest API that is provided by Retail Server and
also the data that is received is in the ODATA format that is a
Universal Format that is used by Microsoft and other third-party
software vendors. More information about ODATA can be found at
http://www.odata.org/.
 The Rest API is fast becoming the most used standard for the
communication between the Server and clients. The Retail server
component uses these universally accepted components and this
helps make the customization easier.
Figure 2-2 : Technical Overview of Retail POS

 Requires Windows 8 computer real-time or Intel architectures


 Application is deployed and updated by using PowerShell
 Requires Activation from the back office, and Retail Server is also configured
through the same application

Development Requirements

Development requirements include the following:

 Windows 8 Intel Architecture


 Visual Studio Experience
 HTML5 and Javascript knowledge
 Knowledge of web APIs with HTTP
 C# and .net fundamental knowledge
Commerce Data Exchange: Real-time Service Calls
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 terminals.

Lesson Objectives

Explain the real-time service functionality of Microsoft Dynamics AX 2012 POS.

Real-time Service Calls

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

Elements discussed in this module include a brief description of how to


extend Retail POS, the Retail POS Plug-ins operations, and the services,
triggers and real-time services.

Tools

Tools to use in Retail POS include the following:

 Visual Studio 2010 Ultimate or a more recent version to customize


Microsoft Dynamics AX 2012 POS.
 Morphx development site to customize the Real-time service that is
used in headquarters.

Test Your Knowledge

Test your knowledge with the following questions.

1. How is Retail POS plug-ins used?

2. When is POS Plug-ins used?

3. Describe the two main components of Retail POS plug-ins.

4. When should Real-time services be used?

5. Explain the difference between services and triggers.

6. Using which Framework Modern POS is created?

7. What is a REST API and How it is used in Retail Server?


Test Your Knowledge Solutions
MODEL ANSWER:

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


that are used 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,
or loyalty.
5. Services contains the core business logic and triggers are events that
are raised by Retail POS that let you insert custom code before or
after operations.
6. Modern POS is created using Windows 8 Modern Architecture.
7. The Rest API is fast becoming the most used standard for the
communication between the Server and clients. The Retail server
component uses these universally accepted components and this
helps make the customization easier.
MODULE 3 - DEVELOPMENT AND CUSTOMIZATION
OF RETAIL POS

Module Overview

This module describes how to extend and customize the Retail POS on Microsoft Dynamics AX 2012 R3.

The module covers the following topics on Retail POS extensibility

 Customizing Retail POS Themes


o POS Skins
o Creating New Skins
o Set Color Properties
 User Interface Extensibility
o How to modify a form in Retail POS
 Trigger Extensibility
o How to modify the trigger project
 Services Extensibility
o How to modify the services project
 Blank Operations Extensibility
o Setup a blank operation
o Add custom logic to the blank operation
 Custom Fields on POS Layouts
 Real Time Service Extensibility
o Extending the RetailTransactionServiceEx Class
 POS Database Tool Extensibility
 POS Payment Connector
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

Retail POS Themes

This lesson describes how to change 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 that are created
by DevExpress. Although you can develop your own forms without using DevExpress, we
recommend that you use these forms for consistency.

Lesson Objectives

 Explain how to create or modify existing Retail POS skins.

03 - 2
Module 3: Development and Customization of Retail POS

POS Skins
Create a New Skin

To create a new skin, follow these steps.

1. Browse to the SkinEditor tool. This tool 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).
2. Double-click the SkinEditor icon to start the tool.
3. Click File->New to open the New Project window.

4. Set the Project Name to MyFirstCustomSkin.


5. Change the Template Skin: field from DevExpressStyle to Office
2010 Blue by using the drop-down arrow.
6. Set the Skin Name: field to MyFirstCustomSkin, and then click
the OK button. Now the new skin project is installed in the
SkinEditor tool, and lists the User Interface (UI) elements that are
called Products. For the rest of this topic, Products will be known
as controls.

03 - 3
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

Set Color Properties on the New Skin

To set the color properties on the new skin, follow these steps.

1. Select the common property from the SkinEditor tool.

03 - 4
Module 3: Development and Customization of Retail POS

2. Set the Common > Control color property to Blue.


3. Set the Common > ControlText color property to White.
4. Click File->Save.
5. Convert the 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:

03 - 5
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

The newly generated skin assemblies are put in the


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

Start Retail POS with the New Skin

For Retail POS to install the new skin, you must put the skin assembly in the Retail
POS runtime folder. Copy the MyFirstCustomSkin.dll to the Skins folder in the
Retail POS runtime directory.

You must also make Retail POS aware of the new skin.

Use Commerce Data Exchange

To use Commerce Data Exchange follow these steps.

1. Open Microsoft Dynamics AX for Retail Headquarters, and then browse to


Retail > Setup > POS > Profiles > Visual Profiles.

2. Right-click Theme on the drop-down menu, and then click View Details.
3. Click the New button, and then set the Retail POS skin name field to
MyFirstCustomSkin.
4. Close the Retail POS skins form, and then with the Retail POS visual
profiles form open, set Theme on the drop-down menu to
MyFirstCustomSkin.
5. Close the Retail POS visual profiles form.

03 - 6
Module 3: Development and Customization of Retail POS

6. Browse to Retail >Periodic >Data Distribution >Distribution Schedule.


Select the 1090 job and then click the Run directly button. Doing this
updates the new skin to Retail POS. You can run the following query against
the AXRetailPOS database to make sure that this procedure worked:
SELECT RETAIL POSSKINNAME, * from RetailVisualProfile

7. Start Retail POS and the new skin’s visualization effects should display similar
to the following image.

03 - 7
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

User-Interface Extensibility
User-Interface Extensibility 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 installs
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.

03 - 8
Module 3: Development and Customization of Retail POS

How to Modify a Form in Microsoft Dynamics AX 2012 R3 Retail POS

This lesson explains how to modify the Microsoft Dynamics AX 2012 R3 Retail 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 having to use the
InteractionDefault service.

Customize Forms by Using InteractionDefault Service

Forms that use this new pattern are included in the InteractionDefaults service.
The list is located at ‘\services\InteractionDefault\winformstouch.’

03 - 9
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

To customize the 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 LogOnForm.cs from

03 - 10
Module 3: Development and Customization of Retail POS

InteractionDefaults project, and then 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\Extensions folder or \Extensions in
the Root Folder (RetailPOS), and then start Retail POS. The
LogOnForm should resemble the following:

How to Modify a Form in the Microsoft Dynamics Ax 2012 R2/R3 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 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.

03 - 11
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

To customize the ItemSearch form, follow these steps.

1. 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.
2. 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.
3. Open the Services folder, and then double-click the Visual Studio solution
file, services.sln.
4. Open the Services folder, and then double-click the Services Visual Studio
solution file.
5. Click the Dialog project, and then expand the WinFormsTouch Folder. Click
frmItemSearch.cs and select view code. To modify the forms, you must have
a DevExpres license.
6. Add the following code in the variable declaration section of the
frmItemSearch class to declare the new column.

private DevExpress.XtraGrid.Columns.GridColumn colSearchString;

7. Initialize the column in InitializeComponent() method.


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

8. 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});

//
// 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;

03 - 12
Module 3: Development and Customization of Retail POS

9. Now, modify the Item Search query to include the new column in the search
criteria so that you can filter and display 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);

10. 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.
11. 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 form:

03 - 13
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

03 - 14
Module 3: Development and Customization of Retail POS

Trigger Extensibility
Trigger Extensibility 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.

Lesson Objectives

 Explain how to extend triggers in Retail POS.


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

03 - 15
Microsoft Dynamics® AX 2012 R3 for Retail in Brick 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.

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 then 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)
{
//reference existing or new logic for adding money
to customer gift cards
}
}
}

03 - 16
Module 3: Development and Customization of Retail POS

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.

03 - 17
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

Services Extensibility
Services Extensibility 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.

Lesson Objectives

 Explain how to extend services in Microsoft Dynamics AX 2012 R2 POS.

03 - 18
Module 3: Development and Customization of Retail POS

How to Modify the Services Project

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

Lesson Objectives

 Explain how to modify the Z-Report by using EOD services project.

How to Modify the Z-Report

If, in the Z-report, you want to print the count of a returned transaction in the
shift, follow these steps.
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 then double-click the Services Visual Studio
solution file.
4. Browse to the EOD project, and then 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();

if (batch != null)
{
dBCommand.Parameters.Add(new

03 - 19
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization
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.

03 - 20
Module 3: Development and Customization of Retail POS

Blank Operation Extensibility


Blank Operation Extensibility Overview

You can use Blank Operations to extend Microsoft Dynamics AX for Retail Point-of-Sale
(POS) by adding custom logic to the Retail POS register buttons. In the Retail POS
register design layout, you can add many 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.

Lesson Objectives

 Explain how to create a blank operation.


 Add the blank operation to the POS layout.

03 - 21
Microsoft Dynamics® AX 2012 R3 for Retail in Brick 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

Set 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 menu, 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 in 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:

03 - 22
Module 3: Development and Customization of Retail POS

Add 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, the folder will be located at
C:\Users\...\Documents\Retail SDK\POS Plug-ins\.
2. Open the Services folder, and then 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 that 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 the new assembly to the POS\Services\Extension folder, and then start
Retail POS. This path applies only for Microsoft Dynamics AX 2012 R2. For

03 - 23
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

later versions, use POS\Extensions.

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

Custom Fields on POS Layouts


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

Lesson Objectives

 Explain how to add fields to the receipt layout.

03 - 24
Module 3: Development and Customization of Retail POS

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.

Add 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.

Any fields that are created in custom fields are available in all three sections of the
receipt format designer—Header, 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.

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.

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

03 - 25
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

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

03 - 26
Module 3: Development and Customization of Retail POS

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

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

03 - 27
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

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

1. Before the modification, take the backup of the existing assembly so that the
original assemblies remain available if you must revert to the original
assemblies.
2. 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\.
3. Open the Services folder, and then double-click the Services Visual Studio
solution file.
4. Locate the FormModulation.cs file in the Printing service. Values for the
header field and the footer field 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
((IPosTransactionV1)theTransaction).BeginDateTime.ToString("HH:mm");

03 - 28
Module 3: Development and Customization of Retail POS

5. 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.

1. 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
o 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.
o Finally, a using LSRetailPosis.Transaction.Line.SaleItem; line
must be added to the top of the ItemTriggers.cs file.

2. 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");

03 - 29
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

3. 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;

4. 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.
5. 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:

 Payment Grid
 Product Receipt Grid
 Totals Area

03 - 30
Module 3: Development and Customization of Retail POS

Real-Time Services Extensibility


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. [For more details see
http://technet.microsoft.com/EN-US/library/retailtransactionserviceex.aspx )

The RetailTransactionServiceEx class is used as a service class between Microsoft


Dynamics AX and the Point-of-Sale (POS).

Lesson Objectives

 Explain how to extend Commerce Data Exchange - Real time service for POS.

03 - 31
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

Extend 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 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
o date
o int
o int64
o str
o guid
o 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 customer’s 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, ''];

03 - 32
Module 3: Development and Customization of Retail POS

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;
}
}

03 - 33
Microsoft Dynamics® AX 2012 R3 for Retail in Brick 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.

3. 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 displays the
customer name on the status panel.
4. 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 (XppPrRetail POStArgs _args)


{
// All the gift card arguments can be fetched from the _args parameter
// write your logic to update the service
}

5. To create a post handler, right-click the giftCardAddTo method, and


then select New Event Handler Subscription.
6. Now, set the properties shown as follows:

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

03 - 34
Module 3: Development and Customization of Retail POS

POS Database Tool Extensibility for Store and Offline


Database
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.

Lesson Objectives

 Explain how to extend the Retail Store Database utility to execute custom SQL
scripts.

03 - 35
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

CreateDatabase Service

The CreateDatabase services project is part of the Retail Software Development Kit
(SDK). The SDK 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.

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:
o DataAccess
o EntityFramework
o POSResources
o SystemSettings
o Transaction
o Microsoft.Dynamcics.Retail.Pos.Contracts
o Microsoft.Dynamcics.Retail.Pos.DataEntity
o Microsoft.Dynamcics.Retail.Pos.DataManager

1. 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 creates a blank text
file in the Upgrades folder.

03 - 36
Module 3: Development and Customization of Retail POS

2. 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

3. 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>

4. 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:schemas-
microsoft-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>

03 - 37
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

</xs:element>
</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.

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


(x86)\Microsoft Dynamics AX\60\Retail Database
Utility\Services.
6. 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.

03 - 38
Module 3: Development and Customization of Retail POS

POS Payment Connector


Microsoft Dynamics AX 2012 R2 /R3 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 locations—retail stores (POS registers),
online stores, and the Microsoft Dynamics AX Accounts Receivable module.

Microsoft Dynamics AX 2012 R2/R3includes one payment connector—the


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 display the required
fields to configure the payment connector. After you configure the payment
connector, you can validate it, and then use the payment connector on a retail
channel. The new payment connector can also support the new touch screen
payment terminal devices.

Lesson Objectives

 Explain how to create the payment connector to work on all Microsoft


Dynamics channels for payment processing.

Disclaimer

You can copy, alter, adapt, modify or create derivative works of the Microsoft
Dynamics AX Payment Software Development Kit (SDK) and this
TemplateConnector for payment card processing. Additionally, you must use the
Microsoft Dynamics SDK and the TemplateConnector only with Microsoft
Dynamics AX 2012 R2 /R3 in your internal business operations and with valid
licenses of Microsoft Dynamics AX 2012.

You must not permit or authorize any third-party to distribute any of the
derivative works of the Microsoft Dynamics AX Payment SDK and the
TemplateConnector.

03 - 39
Microsoft Dynamics® AX 2012 R3 for Retail in Brick 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 to process 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
follow:

IPaymentManager

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

IPaymentProcessor

The Microsoft.Dynamics.Retail.PaymentSDK.IPaymentProcessor is the interface


that is used for all payment processing methods. This interface exposes the
methods and events for handling payments.

ISessionOperation

The Microsoft.Dynamics.Retail.PaymentSDK.ISessionOperation is the interface that


is used to maintain the session for processing. This interface exposes the methods
and events for handling sessions.

Some key methods of the payment connector include the following:

Methods Description

Authorize Used to authorize the payment.

Refund Used to refund the payment.

Void Used to Void the transaction.

03 - 40
Module 3: Development and Customization of Retail POS

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.

03 - 41
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

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.

03 - 42
Module 3: Development and Customization of Retail POS

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 places—merchant 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 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.

03 - 43
Microsoft Dynamics® AX 2012 R3 for Retail in Brick 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 if the error code is
mapped correctly.

Deploy the Payment Connector

How to 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\60\Client\Bin\Connectors

 %Program Files%\Microsoft Dynamics

03 - 44
Module 3: Development and Customization of Retail POS

AX\60\Server\MicrosoftDynamicsAX\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 the connect assembly is
installed, start POS.

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.

In the EFT Service FastTab, select Payment Connector from the first drop-down
menu. The payment connector should then be available to select in the second
drop-down menu. After you select it, your merchant properties should display:

03 - 45
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

03 - 46
Module 3: Development and Customization of Retail POS

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 menu and
complete the merchant properties:

03 - 47
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

LAB –EXTENSIBILITY RETAIL POS


This lab 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 R3 POS
 Understand how to extend services in AX 2012 R3 POS
 Understand how to extend Commerce Data Exchange- Real time
service for POS

03 - 48
Module 3: Development and Customization of Retail POS

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

 Open the Blank Operation project in Visual studio


 Add Blank Operation on the Retail POS register
 Adding item to POS transaction

Detailed Steps
 Open the Blank Operation project in Visual studio
a. 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.
b. Open the Services folder and double-click the Services Visual
Studio solution file.
c. Go to the Blank Operations project and expand it.
d. 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.
e. 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.
f. Open the BlankOperation.cs file and add the below line in the
namespace section
using System;

g. Open the BlankOperation method in BlankOperation.cs file and


find the BlankOperation method, then copy paste the code inside

03 - 49
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

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);
}
}

h. Compile and Build the BlankOperations project by right clicking


the BlankOperation project in Visual studio and select Build.
i. 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 Plug-
ins\Services\BlankOperations\Bin\Release to the Retail Pos\
Extensions folder.

03 - 50
Module 3: Development and Customization of Retail POS

 Add Blank Operation on the Retail POS register


a. 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

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. 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.

03 - 51
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

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


 Perform loyalty prompt request.

Detailed Steps
 Perform loyalty prompt request.

a. 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.
b. Open the Triggers folder and double-click the Triggers Visual
Studio solution file.
c. Open the ItemTriggers project because all the item related
triggers operations are done in this project
d. 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 (Needed only if POS was not
installed to the default location on the local machine.)
ii. POSProcesses.dll (Needed only if POS was not installed to the
default location on the local machine.)
iii. System.Windows.Forms.dll
iv. Microsoft.Dynamics.Retail.Pos.SystemCore.dll
v. Transaction.dll (Needed only if POS was not installed to the
default location on the local machine.)

03 - 52
Module 3: Development and Customization of Retail POS

03 - 53
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

e. 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.
f. Select the ItemTriggers.cs file in ItemTriggers project and double
click the file.
g. 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;

h. 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.
i. 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);
}
}
}

j. After that compile and build the ItemTriggers project by right


clicking the ItemTriggers project in Visual studio and select Build.

03 - 54
Module 3: Development and Customization of Retail POS

k. 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 Plug-
ins\Triggers\ItemTriggers\Bin\Release to the Retail Pos\
Extensions folder.
l. 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

m. If it is first time log on to POS, then POS will display the Shift
form, in that please click "Add a new Shift".
n. 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.
o. 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 doesn’t 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.

03 - 55
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

Task 1: Override the discount amount defined in functionality profile

High Level Steps

 Prompt the user for manager credentials to override the discount


amount.

Detailed Steps

 Prompt the user for manager credentials to override the discount


amount.

a. 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.
b. Open the Services folder and double-click the Services Visual
Studio solution file.
c. Go to the Discount project and expand it.
d. 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.
e. 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:
i. Microsoft.Practices.Prism.Interactivity
ii. Microsoft.Dynamics.Retail.Notification.Contracts

f. 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;

g. Locate the AuthorizeLineDiscountAmount() method in


Discount.cs file.

The logic that enforces the maximum line discount amount is


defined in this method.

03 - 56
Module 3: Development and Customization of Retail POS

h. 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.
i. Clear all the code inside the AuthorizeLineDiscountAmount()
method
j. 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 =

03 - 57
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization
ApplicationLocalizer.Language.Translate(3173, maximumAmountRounded,
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.

k. After that compile and build the Discount project by right


clicking the Discount project in Visual studio and select Build.
l. 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 Plug-
ins\Services\Discount\Bin\Release to the Retail Pos\ Extensions
folder.
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. 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)

03 - 58
Module 3: Development and Customization of Retail POS

q. 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

r. 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).
s. 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

 Update inventoryLookup method to include item inventory status


across all the stores

03 - 59
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

Detailed Steps

 Update inventoryLookup method to include item inventory status


across all the stores
a. Open AX from the Desktop icon and then click Ctrl+D to open
development workspace
b. In the AOT, Go to classes and expand it.
c. Select RetailTransactionService, class and point to
inventoryLookup method
d. Open the inventoryLookup method by double clicking it
e. 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.
f. 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 output = [true,''];


InventLocation inventLocation;
InventQty 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;
inventDim.InventSiteId = inventLocation.InventSiteId;

03 - 60
Module 3: Development and Customization of Retail POS
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;

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


h. 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

i. If it is first time log on to POS, then POS will display the Shift
form, in that please click "Add a new Shift".
j. 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.
k. In the Action drop-down list box, select Inventory lookup and
click OK.
l. After that click the newly added inventory lookup button.
m. The system will display the inventory status across all legal
entities.

Results

View the inventory status across all the stores.

03 - 61
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

Test Your Knowledge


Test your knowledge with the following questions.

1. How can you update the new skin that is created by using the tool in Retail POS?

2. How do you use a payment connector?

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

4. What are triggers?

5. What is the class used for extending Real Time Service.

6. What are the Supported Data Types for Real Time Service calls?

7. How to add Custom Payment Type in Microsoft Dynamics Ax 2012 ?

8. How to add Custom SQL Scripts while creating Store Database?

03 - 62
Module 3: Development and Customization of Retail POS

Test Your Knowledge Solutions


1. For Retail POS to install the new skin, you must put the skin assembly in the
Retail POS runtime folder. Copy the MyFirstCustomSkin.dll to the Skins folder
in the Retail POS runtime directory. Also update the new skin name in Retail
>Setup >POS >Profiles >Visual Profiles, and then run the N-1090
scheduler job.

2. You can use the payment connector to connect any Microsoft Dynamics AX
channel to the payment SDK for payment processing.

3. Copy the connector assembly to the Microsoft Dynamics AX client and the
server Connectors directories:
o %Program Files (x86)%\Microsoft Dynamics
AX\60\Client\Bin\Connectors
o %Program Files%\Microsoft Dynamics
AX\60\Server\MicrosoftDynamicsAX\bin\Connectors

4. Triggers are used to capture events that start before and after Microsoft
Dynamics AX for Retail POS operations

5. To extend Real-time Service, you must create a new method in the


RetailTransactionServiceEx class

6. Supported Datatypes are


I. Boolean
II. date
III. int
IV. int64
V. str
VI. guid
VII. Real
7. Microsoft Dynamics AX 2012 R2/R3 includes a unified payment processing
architecture for processing credit card transactions. You can extend this
architecture by creating your own payment connector.

8. The CreateDatabase services project is part of the Retail Software


Development Kit (SDK). The SDK can be used to create and extend the retail
database. This lesson explains how to extend the CreateDatabase project to
execute custom SQL scripts.

03 - 63
MODULE 4: EXTENDING RETAIL MODERN POS

Module Overview
Microsoft Dynamics AX 2012 R3 includes Modern POS, a point-of-sale app for
PCs, tablets, and phones. Sales staff can process sales transactions, customer
orders, and perform daily operations and inventory management with mobile
devices anywhere in the store, as well as at PC-based registers.

The Modern POS app running on a device is a thin client. It must connect to
Microsoft Dynamics AX Retail Server. Retail Server performs the business logic and
processing for Modern POS

The Modern POS system behavior can be customized in several ways. For
example, modifying the information that is made available to modern POS by
extending a commerce entity to include a new column from the Microsoft
Dynamics AX database. The new column in commerce runtime can then be used
in a service and workflow, and exposed in the commerce runtime API. If the
commerce entity is modified, the corresponding controller and metadata in Retail
Server have to be customized.

In other extensibility scenarios, every layer of the stack need not be modified. For
example, simply modify the way a workflow behaves without modifying the
database schema.

The Retail SDK includes apps for various clients. You can customize those apps to
match the branding of your organization or to extend their functionality.

Objectives

Note: The Retail Modern POS is comprised of pre-release components. All


pre-release features and functionality are preliminary based on current
expectations, and are subject to change without notice.

The objective of this module is to enable the student gain an understanding of

1. Understanding of the Retail Modern POS architecture


2. Extending the Retail Modern POS
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

Architecture of the Retail Modern POS


The topic describes the architecture of Microsoft Dynamics AX Retail Modern point of sale (POS).

Lesson Objectives

Understand the various components of the Microsoft Dynamics AX Retail Modern


point of sale(POS) architecture

Modern POS Topology

Modern POS clients can communicate with Retail Servers that are deployed in
your store or in a data center. Modern POS clients can also communicate with
peripheral devices such as cash drawers, credit card readers, and printers by using
Microsoft Dynamics AX Hardware Station. Hardware Station must be deployed in
your store and all Modern POS clients can connect to the same Hardware Station.

On supported laptops, tablets, and phones, Modern POS users can perform a
variety of retail tasks. These include processing sales transactions, viewing
customer orders, managing daily operations and inventory, or viewing role-based
reports. The Microsoft Dynamics AX Modern POS device is a client. It does not
perform business functions or data processing. All business functions are provided
by Microsoft Dynamics AX Retail Server.

The diagram below illustrates the Retail Modern POS Topology

04 - 2
Module 4: Extending Retail Modern POS

FIGURE 04.1: MODERN POS COMPONENTS

Modern POS Architecture

The Modern POS app running on a device is a thin client. It must connect to
Microsoft Dynamics AX Retail Server. Retail Server performs the business logic and
processing for Modern POS.

The view, view-controller, and devices layers depend on the operating system (for
example, Windows Surface) on which you plan to deploy Modern POS. The other
layers are operating system independent and use Typescript classes and modules
to perform Modern POS functionality such as workflows and entities.

The diagram below illustrates the Retail Modern POS Architecture

FIGURE 04.2: RETAIL MODERN POS ARCHITECTURE

Cascading Style Sheets and HTML5

Cascading style sheets is a style sheet language that is used to describe the look
and format of a document that is written in a markup language. Although

04 - 3
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

frequently used to style web pages and interfaces that are written in HTML and
XHTML, the language can be applied to any kind of XML document. This includes
plain XML, SVG and XUL. Cascading style sheets is a cornerstone specification of
the web and most webpages use Cascading style sheets to describe their
presentation.

Information on the web technologies that can be used to theme HTML5 pages
can be found at http://www.microsoftvirtualacademy.com/training-
courses/html5-css3-fundamentals-development-for-absolute-beginners

Overview of Retail Server Architecture

This topic describes the architecture of Retail Server. Retail Server provides services
and business logic for Modern Point of Sale (POS) clients.

Retail Server is installed by using Microsoft Dynamics AX Setup.exe or Windows


PowerShell. You can install it on a server in a store or in a datacenter. The
Microsoft Dynamics AX Commerce runtime is wrapped in a Retail Server layer.
Retail Server uses a web API with OData to support thin clients within the store
like tablets and phones. Commerce runtime communicates through Commerce
Data Exchange services to Microsoft Dynamics AX for Retail Headquarters.

Retail Server utilizes the following concepts.

Concept Description
Entity type An entity type is an entity that has a lifecycle
you want to monitor. Each entity type has a
key. An example of an entity type is Customer.

Complex type A complex type is an OData concept that is


designed to avoid duplication by grouping
certain related properties. These related
properties can be reused in multiple entities.
For example, Customer is an entity type that
has a customer address, which is a wrapper
that contains an address line, city, state, and
zip code. Customer address is a complex type
that can be reused by other entity types like
Order, because the Order entity type would
need the same address information that is
associated with the Customer entity.

Controller  A controller is a mapping for an entity


type that controls CRUD behaviors and
actions for the entity type. Microsoft
Dynamics AX provides a controller for

04 - 4
Module 4: Extending Retail Modern POS

Concept Description
each commerce entity. You can customize
the following controllers:
 Carts
 Catalogs
 Categories
 Commerce
 Commerce Lists
 Composite Key Entity
 Controller Assembly Resolver
 Customers
 Employees
 Non-Bind able Action
 Org Units
 Picking Lists
 Products
 Purchase Orders
 Sales Orders
 Shifts
 Stock Counts Journals
 Transfer Orders

Metadata Metadata defines the contract between the


client and the server.

To extend the Retail Server you can create your own entity type or complex type,
extend an existing controller, add a new controller, and customize the metadata. If
the commerce runtime is customized, then the various components in Retail
Server should also be customized to expose those changes to Modern POS clients.

Overview of Microsoft Dynamics AX Retail Server Architecture with Extensibility

04 - 5
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

Figure 04.3: Retail Server Architecture

Retail Modern POS Customization and Extensibility


The Modern POS system behavior can be customized in several ways. For
example, modifying the information that is made available to modern POS by
extending a commerce entity to include a new column from the Microsoft
Dynamics AX database. The new column in commerce runtime can then be used
in a service and workflow, and exposed in the commerce runtime API. If the
commerce entity is modified, the corresponding controller and metadata in Retail
Server have to be customized.

In other extensibility scenarios, every layer of the stack need not be modified. For
example, simply modify the way a workflow behaves without modifying the
database schema.

The Retail SDK includes apps for various clients. You can customize those apps to
match the branding of your organization or to extend their functionality.

Customization of the Retail Modern POS may involve the following

1. Extending Microsoft Dynamic AX and Commerce Data Exchange


2. Extending Commerce Run Time
3. Extending Retail Server
4. Extending the Modern POS Client

04 - 6
Module 4: Extending Retail Modern POS

Lesson Objectives

This lesson provides an overview of the various components involved in extending


the Retail Modern POS

Extending Microsoft Dynamics AX

The following are the main tasks to be done on the Microsoft Dynamics AX side

Task Details References


Customize the If you add one or more new Customize the Data
database schema fields to a table in Microsoft in a Commerce
Dynamics AX, a commerce Entity
entity in the commerce http://technet.micros
runtime automatically includes oft.com/EN-
those fields as long as you US/library/jj916616.as
make changes to the stored px
procedure or view to return Walkthrough:
the additional field. Adding a table for
customer
preferences to the
AX 2012 database
http://technet.micros
oft.com/EN-
US/library/dn720785.
aspx

Customize Commerce Data Exchange: Extend the


Commerce Data Real-time Service is a Windows Commerce Data
Exchange: Real-time Communication Foundation Exchange: Real-time
Service (WCF) service that uses .NET Service
Business Connector to enable http://technet.micros
retail clients to communicate oft.com/EN-
with Microsoft Dynamics AX in US/library/dn126098.
real time. You can customize aspx
Real-time Service by adding
extension methods to the
RetailTransactionServiceEx
class.

Enable debugging You can use the X++ Debug X++ Code
debugger to debug from for Retail
commerce runtime to Real- http://technet.micros
time Service to Microsoft oft.com/EN-
Dynamics AX, but you must

04 - 7
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

Task Details References


create Microsoft Dynamics AX US/library/dn126099.
configurations for your local aspx
client and Business Connector,
and then update the Business
Connector configuration in the
registry editor.

Extend the Commerce Runtime

The commerce runtime is a set of assemblies that enables your store to obtain
interactive data based on a shopping cart. The commerce runtime includes several
services that query for real-time data. It also includes workflow business logic that
enforces rules for your store.

Task Details References


Customize data in a The CommerceEntity class is a Customize the
commerce entity property bag of key value pairs Data in a
of C# properties. These Commerce Entity
properties provide string http://technet.micr
representations of fields from osoft.com/EN-
the database so that you do US/library/jj916616
not need to remember the .aspx
names of columns in your Walkthrough:
database when you write code. Adding a table for
For any existing data type, if customer
you add one or more new preferences to the
fields to a table in Microsoft AX 2012 database
Dynamics AX, the commerce http://technet.micr
entity automatically includes osoft.com/EN-
those fields as long as you US/library/dn72078
make changes to the stored 5.aspx
procedure or view to return the Walkthrough:
additional field. Extending the CRT
to add customer
preference data
for Retail clients
http://technet.micr
osoft.com/EN-
US/library/dn72079
0.aspx

04 - 8
Module 4: Extending Retail Modern POS

Task Details References


Customize services Microsoft Dynamics AX offers Services Overview
many services in the commerce for Commerce
runtime that support the basic Runtime
functionality of a store. If one http://technet.micr
of these services does not meet osoft.com/EN-
the needs of your store, you US/library/jj916617
can replace it with your own .aspx
service and continue to use the Integrate a Service
other services that are installed into the
with the commerce runtime. Commerce
Runtime
http://technet.micr
osoft.com/EN-
US/library/jj916619
.aspx
Walkthrough:
Integrating a new
Shipping Service
http://technet.micr
osoft.com/EN-
US/library/jj916622
.aspx

Customize workflow The commerce runtime Create Commerce


includes workflow business Runtime
logic that enforces rules for Workflows
your business. You can use the http://technet.micr
workflows that are included in osoft.com/EN-
commerce runtime or create US/library/jj916618
your own. .aspx

Use the API You can use the API for things .NET Framework
like getting information about Classes for
items, price calculation, Microsoft
shipping calculation, and Dynamics AX
placing orders. You can extend Commerce
the API to fit your business Runtime
processes. http://technet.micr
osoft.com/EN-
US/library/jj992752
.aspx

04 - 9
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

Task Details References


Deploy your After you customize the
commerce runtime functionality of your store in
customizations the commerce runtime, use the
GAC utility to copy your new
DLLs to your solution

Extend Retail Server

The Microsoft Dynamics AX Commerce runtime is wrapped in a Retail Server layer.


Retail Server uses a web API with OData to support thin clients within the store
like tablets and phones. Commerce runtime communicates through Commerce
Data Exchange services to Microsoft Dynamics AX for Retail Headquarters.

Task Details References


Create a new If you create a new commerce Create a new
controller entity or complex type, you need Retail Server
to create a new controller to Controller
expose actions that you want to be http://technet.micr
available. After you create a new osoft.com/EN-
controller, you must modify the US/library/dn74146
metadata to use it. 1.aspx

Extend an existing You can integrate a new controller Extend a Retail


controller or extend on of the controllers that Server OData
come with Microsoft Dynamics AX. Controller
If you add a commerce entity or http://technet.micr
action, you must modify the osoft.com/EN-
metadata to use it. US/library/dn74144
7.aspx

Extend metadata Metadata defines a contract Extend the


(OData) between client and server. It metadata
exposes the entity definition and http://technet.micr
action definition, so when you osoft.com/EN-
make a change on the server side, US/library/dn74145
you can use a tool on the client 8.aspx
side to generate proxy code,
reducing maintenance effort for
developers. To consume new
commerce entities and actions, you
must extend the metadata,
otherwise the client won’t know
about it.

04 - 10
Module 4: Extending Retail Modern POS

Task Details References


Use Web API and You can create your own Web API Use Web API and
OData controllers controller and extend the Web API OData controllers
together configuration as an alternative to together
using the standard OData http://technet.micr
controllers. osoft.com/EN-
US/library/dn74143
7.aspx

Retail Server You can reference API .NET Framework


reference documentation for the Classes for
Microsoft.Dynamics.Retail.RetailServe Microsoft
rLibrary assembly. Dynamics AX
Retail Server
http://technet.micr
osoft.com/EN-
US/library/dn72036
3.aspx

Incorporate your You need to copy the DLL into the


changes retail server bin folder. You need to
repackage the new DLL into the
same MSI installation package. You
also need to modify the
Web.config file to make sure the
DLL is processed, just like the
commerceruntime.config file.

Extend Modern POS Client

You can customize the look and feel of a Modern POS client to make it an
extension of your brand. We recommend that you use your own file names and
namespaces for any customizations.

Task Details References


Extend You can install the Windows 8.1 packaged Retail SDK
Modern Modern POS app by using the Microsoft http://technet.
POS for Dynamics AX setup wizard, but you can’t extend microsoft.com/
a it. The Retail SDK includes sample code that you EN-
Windows can use to extend the Windows 8.1 Modern POS US/library/dn7
client app to meet your needs. 20295.aspx
To use the Windows 8.1 Modern POS sample TypeScript for
code that is included in the Retail SDK, you must Visual Studio
2012 and 2013

04 - 11
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

Task Details References


install TypeScript for Visual Studio 2012 and http://www.mic
2013. rosoft.com/en-
us/download/d
etails.aspx?id=
34790
Windows Dev
Center
http://msdn.mi
crosoft.com/en
-
US/windows/ap
ps/

Extend The Retail SDK includes sample code that you Retail SDK
Modern can use to create your own Windows Phone http://technet.
POS for Modern POS app. microsoft.com/
Windows EN-
Phone US/library/dn7
client 20295.aspx
Windows
Phone Dev
Center
http://develope
r.windowsphon
e.com/en-us

Enable The Windows Phone app in the Retail SDK Enable reports
Modern contains code you can use for reports. You must for Microsoft
POS for install Silverlight libraries, uncomment code Dynamics AX
Windows from certain files in the Windows Phone app, Retail
Phone and then add references to the Silverlight Windows
reports toolkit. Phone Point of
Sale
http://technet.
microsoft.com/
EN-
US/library/dn7
41448.aspx

Package After you have customized one of the mobile Create an app
your apps that are available in the Retail SDK, you can package
changes

04 - 12
Module 4: Extending Retail Modern POS

Task Details References


package your solution so that it can be installed http://msdn.mi
on devices. crosoft.com/en
-
To package your app, in Visual Studio, click
us/windows/ap
Project > Store > Create App Packages. On the
ps/hh975357.as
Create Your Packages screen, select No, and then
px
complete the wizard.

Install a After you extend one of the apps that are Install Modern
customiz available in the Retail SDK, you must use side- POS
ed app loading to install it to devices. http://technet.
microsoft.com/
EN-
US/library/dn7
41434.aspx#Cu
stomized

04 - 13
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

Exercise 1: Extensibility of MPOS


Exercise Scenario

This exercise illustrates adding a field to a retail channel that enables customers to
opt in to receive special offers by email. In this scenario, the retailer wants to
indicate whether customers wish to receive email about special offers in a modern
POS client.

The exercise should be completed in the following order:

1. Extend Microsoft Dynamics AX: Adding a table for customer


preferences to the AX 2012 database
2. Extend Commerce Run Time: Extending the CRT to add customer
preference data for Retail clients
3. Extend CDX: Extending retail data distribution infrastructure for
customer preferences
4. Extend Modern POS: Extending the Modern POS UI to collect
customer email preferences

Task 1: Extend Microsoft Dynamics AX: Adding a table for customer


preferences to the AX 2012 database and Extend Dynamics AX 2012
R3 customer form to collect/update email preference

High Level Steps

Create the RetailCustPreferences table

Add the new fields to Customer form

Detailed Steps

Create the RetailCustPreferences table

Create a new Dynamics AX 2012 R3 table


1. Launch to Dynamics AX 2012 R3 , go to (press Ctrl+Shift+W) AOT >
Data Dictionary > Tables
2. Create a new table RetailCustPreference

04 - 14
Module 4: Extending Retail Modern POS

3. Create a new field EmailOptIn as enum NoYes

04 - 15
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

4. Create a new relationship with CustTable

04 - 16
Module 4: Extending Retail Modern POS

5. Add a Primary Key based foreign key to the CustTable relation, and
set the SourceEDT as CustAccount, rename the newly created field
CustTable to AccountNum

6. Set the ExtendedDataType of field AccountNum as CustAccount, and


Mandatory as Yes

04 - 17
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

7. Save the changes and click Synchronize to sync the changes to


database

04 - 18
Module 4: Extending Retail Modern POS

8. Generate the CIL code for the new table by clicking Compile

Add the new fields to Customer form

1. Launch to Dynamics AX 2012 R3 , go to AOT > Forms > CustTable


2. Add RetailCustPreference as a Data Source with JoinSource as
CustTable and LinkType as OuterJoin

04 - 19
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

3. Add a new UI group named CustomerPreference with Caption as


Customer Preference to CustTable form under Retail fasttab

4. Add a new field EmailOptIn from table RetailCustPreference within


the CustomerPreference group

04 - 20
Module 4: Extending Retail Modern POS

5. Update method CustTable: write to set


retailCustPreference.AccountNum = custTable.AccountNum;

6. Update method CustTable: validateWrite to set


retailCustPreference.AccountNum = custTable.AccountNum;

04 - 21
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

7. Save and compile the changes


8. Go to Accounts receivable > Common > Customers > All
customers, edit a customer record, go to Retail fasttab, check Email
Opt In checkbox, and save.

Task 2: Extend Commerce Run Time: Extending the CRT to add


customer preference data for Retail clients

High Level Steps

In the CRT, each entity is represented by a key-value pair. The key has the name of
the column name in the table or view. The value is the value of the field for that
column in the view. When you create the new fields in the CustomersView, the
new key-value pair is included in the property bag. For more information see
Customize the Data in a Commerce Entity- http://technet.microsoft.com/EN-
US/library/jj916616.aspx

Next, you will modify the stored procedure associated with the CustomersView
view. This enables writing the data back to Microsoft Dynamics AX.

Create a new table in Channel Database for CRT to use

Modify the CustomersView view in the channel database

Set up and run a subjob to synchronize values for the new data field to the online
channel database

Update the SQL Server Stored Procedure Code

Detailed Steps

04 - 22
Module 4: Extending Retail Modern POS

In the CRT, each entity is represented by a key-value pair. The key has the name of
the column name in the table or view. The value is the value of the field for that
column in the view. When you create the new fields in the CustomersView, the
new key-value pair is included in the property bag. For more information see
Customize the Data in a Commerce Entity - http://technet.microsoft.com/EN-
US/library/jj916616.aspx.

Next, you will modify the stored procedure associated with the CustomersView
view. This enables writing the data back to Microsoft Dynamics AX.

Create a new table in Channel Database for CRT to use

1. Open Microsoft SQL Server Management Studio.


2. In Object Explorer, expand the database node for and then expand
the Tables node.
3. Scroll down to the RetailCustPreferences table. Right-click the table,
point to Script table as, then point to CREATE to, and then click New
Query Editor Window.
4. Go to the top line of the generated script and change the USE
statement to the name of the channel database (aka the CRT
database). The default name for this database after you install
Microsoft Dynamics AX 2012 R3 is AxRetailSP. If that is the name of
your channel database, the following example illustrates the USE
statement. USE [AxRetailSP]
5. Remove the PARTITION field.
6. Change all instances of dbo to ax for the field names.
7. Click Execute or press F5 to run the script.

Modify the CustomersView view in the channel database

You must add the EmailOptIn field to the CustomersView view in the channel
database to make the new field available in the Retail online sample store.

1. Open Microsoft SQL Server Management Studio. You must be logged


on to the computer with the account that has permissions to modify
the Retail databases.
2. In Object Explorer, expand the database node for your channel
database. The default name for this database after you install
Microsoft Dynamics AX 2012 R3 is AxRetailSP.
3. Expand the Views node and right-click dbo.Customersview.
4. Click Script View as, ALTER to, New Query Editor Window.
5. Add the following lines to the query to include the EmailOptIn field in
the CustomersView.
(SELECT TOP (1) EMAILOPTIN
FROM dbo.RetailCustPreferences

04 - 23
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

WHERE (ACCOUNTNUM = dbo.CUSTTABLE.ACCOUNTNUM)) AS EmailOptIn,


6. Save your changes and re-run the query.

Set up and run a subjob to synchronize values for the new data field to the online
channel database

You run jobs to synchronize data from AX 2012 to the CRT. For more information,
see http://technet.microsoft.com/EN-US/library/jj680084.aspx

In the AX 2012 Distribution schedule form, create a subjob under the Customer
job for RetailCustPreferences. Run the jobs that synchronize initial data in AX 2012
to the distribution location

Update the SQL Server Stored Procedure Code

Review the entire contents of the sample code for CommerceRuntimeScripts.sql


available at

http://technet.microsoft.com/EN-US/library/dn720790.aspx

There are four places where code has been inserted. Search for
SDKSAMPLE_CUSTOMERPREFERENCES to find them.

Note: SAMPLE CODE NOTICE


THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR
IMPLIED, OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS,
OR CONDITIONS OF MERCHANTABILITY. THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS
SAMPLE CODE REMAINS WITH THE USER. NO TECHNICALSUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS
CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.

Task 3: Extend CDX: Extending retail data distribution infrastructure


for customer preferences

High Level Steps

Add the RetailCustPreferences table in the data distribution to the CRT for the
Retail channel

Create a Sub Job

Detailed Steps

Add the RetailCustPreferences table in the data distribution to the CRT for the
Retail channel

The channel schema is the XML description of the data sent from AX 2012 to the

04 - 24
Module 4: Extending Retail Modern POS

channel database.

1. Launch to Dynamics AX 2012 R3 , go to Retail > Setup > Retail


scheduler, open Retail channel schema, and select AX 2012 R3

2. Create a new Location tables with table name as


ax.RETAILCUSTPREFERENCES

3. Add four Location fields, ACCOUNTNUM, DATAREAID,EMAILOPTIN,


RECID
Field name Type Length
ACCOUNTNUM None 0
DATAREAID None 0

04 - 25
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

Field name Type Length


EMAILOPTIN None 0

RECID None 0

4. Close the Location fields and Location tables forms.

Create a Sub Job

Next create a Subjob of the CustTable job to move data in the new table to the
channel database.

1. Create a new subjob RetailCustPreference with the following


highlighted data by going to Retail > Setup > Retail scheduler >
Scheduler subjobs form

04 - 26
Module 4: Extending Retail Modern POS

2. Enter RetailCustPreference in the Subjob number and Description


fields.
3. Select AX2012R3 for Retail Channel Schema
4. Select ax.RetailCustPreferences for Channel table name
5. Select RetailCustPreferences for Microsoft Dynamics AX Table name
6. On Scheduler subjob form action pane, click Transfer field list to
open the Field list form

7. On the Field list form, click Functions and then click Match fields to
generate all matching fields. The From Field and To Field columns
are filled in.

04 - 27
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

8. Click OK on the message dialog to close the Field List form


9. Next click Retail > Setup > Retail scheduler, open Retail channel
schema, and select AX 2012 R3, in the Retail data distribution fast tab,
10. Copy the XML in the Table Distribution field into an editor such as

04 - 28
Module 4: Extending Retail Modern POS

Notepad++. [To copy all the XML position your cursor and click
before the first character (<). Using the scrollbar, scroll to the bottom
of the file. Press Shift and then click after the last character (>). This
ensures that all the XML is selected.]
11. In the XML search for the line <Table name= “RetailCustTable”>.
There are two instances it appears.
12. Add the following highlighted RetailCustPreference definition after
the final line in both of the <Table name= “RetailCustTable”> code
blocks. You add the code after the </Table> statement.

<Table name="RetailCustPreferences">

<LinkGroup>

<Link type="FieldMatch" fieldName="accountNum"


parentFieldName="AccountNum" />

</LinkGroup>

</Table>

13. Copy the entire new XML file into the Table Distribution window on
the Retail channel schema form.

14. Close the Retail Channel Schema form


15. Open the Scheduler Jobs form ( click Retail > Setup > Retail scheduler
> Scheduler jobs form)
16. Select 1010 to select the Customer job and then select
RetailCustPreference for the subjob.

04 - 29
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

17. On the Retail Channel Schema form, select AX 2012 R3 for the
schema name and then click Generate Classes to generate needed
CDX Async classes

Task 4: Extend Modern POS to collect email preferences

High Level Steps

Extend Modern POS user interface to collect email preference

Detailed Steps

Extend Modern POS user interface to collect email preference

04 - 30
Module 4: Extending Retail Modern POS

1. Go to C:\Microsoft Dynamics\Retail SDK\POS


Clients\Windows\C1, launch Visual Studio 2012 and open POS.sln
Windows 8 POS project
2. Add the following two UI resource texts in POS\Assets\Strings\en-
US\resources.resjson under section CUSTOMERADDEDIT RESOURCES
. RANGE: [1300 - 1399]

a. Add the following code to the contractor of class


CustomerAddEditViewModel

// HOL

this.emailOptIn = ko.observable(false);

04 - 31
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

this.emailOptIn.subscribe((newEmailOptIn) => {

//if (this._emailOptInProperty && this._emailOptInProperty.Value) {

// this._emailOptInProperty.Value.IntegerValue = (newEmailOptIn ? 1 :
0);

//}

this.addUpdateExtensionProperty(this._emailOptIn_Key, (newEmailOptIn
? 1 : 0));

});

// HOL

b. Add the following method to class


CustomerAddEditViewModel

// HOL

private addUpdateExtensionProperty(key: string, intValue: number) {

if (this.CustomerProxy) { if
(!this.CustomerProxy.ExtensionProperties()) {

this.CustomerProxy.ExtensionProperties = ko.observableArray([]);

04 - 32
Module 4: Extending Retail Modern POS

var properties =
this.CustomerProxy.ExtensionProperties().filter((property) => {

return property.Key === key;

});

var emailOptInP: Model.Entities.CommercePropertyClass;

if (ArrayExtensions.hasElements(properties)) {

emailOptInP = properties[0];

else {

emailOptInP = new Model.Entities.CommercePropertyClass();

emailOptInP.Key = key;

this.CustomerProxy.ExtensionProperties().push(emailOptInP);

if (!emailOptInP.Value) {

emailOptInP.Value = new
Model.Entities.CommercePropertyValueClass();

emailOptInP.Value.IntegerValue = intValue;

// HOL

04 - 33
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

c. Add the following code in the call back of


this.customerManager.getCustomerDetailsAsync in method
CustomerAddEditViewModel.LoadCustomer

// HOL

var properties = customer.ExtensionProperties.filter((property)


=> {

return property.Key === this._emailOptIn_Key;

});

if (ArrayExtensions.hasElements(properties)) {

var emailOptInProperty= properties[0];

if (emailOptInProperty.Value) {

this.emailOptIn(emailOptInProperty.Value.IntegerValue
=== 1);

04 - 34
Module 4: Extending Retail Modern POS

// HOL

3. Extend the customer page to add email preference in


Views\Customer\CustomerAddEditView.html under the Phone
number section

<!-- HOL: Email preference -->

<div>

<br />

<input tabindex="8" type="checkbox" id="specialOfferTabRead"

data-bind="checked:
customerAddEditViewModel.emailOptIn"/>

<label for="specialOfferTabRead" data-bind="resx: {


textContent: 'string_1366' }">Receive special offers?</label>

</div>

04 - 35
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

4. Build the project by going to BUILD > Build Solution in Visual


Studio 2012
5. Create a package by selecting POS project, then go to menu
PROJECT > Store > Create App Packages…,

select No

6. Follow the steps and enter needed info, click Create to create the

04 - 36
Module 4: Extending Retail Modern POS

package

7. Deploy the package location to deploy the package Go to ..\POS


Clients\Windows\C1\AppPackages\RetailModernPOS_x64_Test,
right click Add-AppDevPackage.ps1 and select Run with
PowerShell, and follow the steps to complete the deployment
8. Test your app

Exercise 2: Customization of the Modern POS from


Microsoft Dynamics AX HQ
Exercise Scenario

In this scenario you will walkthrough simple customizations of the Modern POS
which can be done from the Retail HQ

Task 1: Add an image to the database

High Level Steps

Add a Login Image and Welcome Screen Image

Detailed Steps

Add a Login Image and Welcome Screen Image

04 - 37
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

To add an image to the database, follow these steps.

Before you start the task select an image for the Login Page and Welcome Page
of the Modern POS and save the image files in a folder of the computer where
this configuration will be done

1. In Microsoft Dynamics AX browse to Retail > Setup > POS> Images,


click New and then enter Image ID: 9000 and then click Select
image.
/
2. Browse to the folder where the images are maintained and select the
login screen image.
/
3. Click New, enter Image ID 9001, click Select image, and then select
the Welcome Screen image.
/
4. Click Close.
/

Task 2: Add a new visual profile

High Level Steps

Create a new visual profile setup

Detailed Steps

Create a new visual profile setup

To create a new visual profile, follow these steps

1. Browse to AX > Retail > Setup > POS > Profiles > Visual profiles, and
then click New.
/

Specify the following information and close the form.

o Profile number: HOL1


o Description: HOL Visual Profile
o Application Type: Modern POS for Windows
o Theme: Dark
o Accent color: Red
o Login background: 9000

04 - 38
Module 4: Extending Retail Modern POS

Task 3: Create a new Register

High Level Steps

Create a new Modern POS Register

Detailed Steps

Create a new Modern POS Register

To create a new register, follow these steps.

1. In Microsoft Dynamics AX browse to Retail > Setup > POS > POS
registers, and then click New.
/

Specify the following information and close the form.

o Register number: HOUSTON-12


o Name: HOL Register
o Store: Houston
o Hardware profile: HW002
o Visual profile: HOL1

Task 4: Create a new button grid for the Modern POS

High Level Steps

Create new button grid to be used by the Modern POS UI

Detailed Steps

Create new button grid to be used by the Modern POS UI

To create a new button grid, follow these steps.

1. Browse to Retail > Setup > POS> Button grids, click New and
specify the following, and then click Designer.
o Button grid ID: HOL1
o Name: HOL Tasks
2. Expand the form so that all the options are visible, and then select
“New design.”
/
3. Specify 6 rows and 4 columns, and then click OK.
/

04 - 39
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

Create a button grid with the following layout by deleting buttons and setting the
row and column span for the remaining buttons.

Specify the button grid operations, colors, fonts, and images for each button.

Task 5: Define a Screen Layout

High Level Steps

Create a new screen layout to be used by the Modern POS

Detailed Steps

Create a new screen layout to be used by the Modern POS

To define a new screen layout, follow these steps.

1. In Microsoft Dynamics AX, browse to Retail > Setup > POS > Screen
layouts, click New and then specify the following:
 Screen layout ID: HOL1
 Name: HOL1
 Device application: Windows 8
 Height: 768
 Width: 1366
2. In the Button grids section click Add and then select the following:
o Welcome screen 1 = 850 “Get Started”
o Transation screen 1 = HOL1 “HOL Tasks”
o Transaction screen 2 = FAB802 “Payment methods”
3. In the Images section, click Add and specify the following, and then
click Designer.Add Welcome screen 1 = 9001
1. Use the drag-and-drop designer to add the following components to
the layout:

04 - 40
Module 4: Extending Retail Modern POS

o Tab control that contains:


 Transaciton button grid 1
 Customer panel (Select elements to show)
o Receipt pane with the following columns:
 Lines
 Product name, Quantity, Total (without tax)
 Payments
 Payment method, Currency, Amount
 Delivery
 Product name, Delivery method, Status
o Totals panel
 Right column:
 Subtotal
 Tax
 Payment
2. Click OK to save your changes.

Task 6: Add the screen layout to a user and replicate changes to


channel

High Level Steps

Assign the newly create screen layout to a user

Replicate changes to channel

04 - 41
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

Detailed Steps

Assign the newly create screen layout to a user

To assign the screen layout to a user, follow these steps.

1. In Microsoft Dynamics AX, browse to Retail > Common > Workers.


Find worker 000164 – Thomas Hamborg, and then click Edit.
/
2. Click the Retail option and then click Add screen layout HOL1.
3. Close the form when you are finished.

Replicate changes to channel

To replicate changes to the channels, follow these steps.

1. In Microsoft Dynamics AX, browse to Retail > Periodic > Data


distribution > Distribution schedule.
2. Select job “1090 – Registers” and then click “Run now.”

/
3. Select job “1060 – Staff” and then click “Run now.”
4. Give the jobs some time to finish and then return to Modern POS.

Results

Add an Image

Create a new visual profile

Create a new Modern POS Register

04 - 42
MODULE 5: EXTENSIBILITY TESTING
CONSIDERATIONS

Module Overview
This module explains the different ways to test Point of Sale (POS) and the
information that you must consider before testing begins.

Objectives

Explain the testing considerations for several testing types for the POS
customization.
Microsoft Dynamics® AX 2012 R3 for Retail in Brick 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. Unit tests 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

Configuration testing is 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

Functional testing 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 that is being tested.

Integration Testing

Integration testing is performed 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

Performance testing is performed by the performance engineer. Performance

05 - 2
Module 5: Extensibility Testing Considerations
testing involves Functional testing that is performed to evaluate the compliance of
a system or component that has specified performance requirements.

User Interface (UI) Testing

User Testing 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

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

05 - 3
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

Bar Code Scanner

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

Printers

Printer testing verifies whether the correct information that is related to an item is
printed on different receipts that are generated at the printer. The correct
information that is related to the customer, such as the items ordered and the
total should be printed on the receipts.

Weighing Scale

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

Cash Drawer

Cash draw testing 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 item that is ordered and the price. This helps
the customer view the item he or she ordered. Line display testing also displays
the amount due, the amount tendered 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

Keyboard testing 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. EFT testing should also display the
PCI complaint.

ISV Integration Testing

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

05 - 4
Module 5: Extensibility Testing Considerations
standard operations.

05 - 5
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

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 available to test
applications which will help prevent 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 third-
party elements. Systematic test design techniques are followed to reduce the
complexity of interfaces.

Test Lab Maintenance

Because lots of hardware is usually connected to a POS, hardware requires a large


amount of space to house. 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 infrastructures.

PCI Compliance

Care must be taken to implement the PCI-compliant, tamper-proof infrastructure


at all POS terminals to protect cardholder data and identity.

05 - 6
Module 5: Extensibility Testing Considerations

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
 Must have offline POS
 Must have a hardware configuration 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


 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

Performance Testing Considerations


 Install testing for all terminals for each store server and for each store
server for every real-time server
 Data volumes
 Install testing of POS for item scanning
 Frequency of the scheduler jobs

05 - 7
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

 Hardware configuration and sizing


 Network latency and bandwidth

UI Testing Considerations
 Ease of usage
 Screen resolution of the target systems

05 - 8
Module 5: Extensibility Testing Considerations

Module Review
Module Review and Takeaways
This module explained the different kinds of testing that is involved in the POS
deployment. Additionally, the module explained the testing challenges that are
involved and the elements that you must consider before testing begins.

Test Your Knowledge


Test your knowledge with the following questions.

1. Which command is used to start POS in test mode?

2. In which table is the POS Automation test scripts inserted?

05 - 9
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

Test Your Knowledge Solutions


MODEL ANSWER:

1. -te
2. POSISTESTs and POSISTESTPROCESS

05 - 10
MODULE 6: EXTENSIBILITY DEPLOYMENT AND
HOTFIX UPDATE CONSIDERATIONS

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

We strongly recommend that you install all updates in a test or backup


environment before you install them in production environments. Then validate
the update against the implementation, customizations, data, and processes that
are currently used in your organization.

Objectives

The objectives are:

 Explain POS customization/update deployment planning.


 Explain the steps that are required for the retail hotfix or for the
update deployment.
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

Planning POS Customization deployment


This lesson describes the planning that is required for the deploying POS
customizations.

If you are running a retail environment, there are additional steps that you must
perform to deploy updates and hotfixes to computers running Retail POS,
Commerce Data Exchange components, or a store database. Retail software at the
store can be updated in any order or simultaneously.

Updates for retail environments may be either binary or application updates.


Application updates are installed like other Microsoft Dynamics AX application
updates, by installing to a database server, and then recompiling. Only binary
updates require additional steps.

We recommend that you perform these steps initially in a test environment local to
your headquarters, validate that all fixes perform as anticipated and then roll them
out to your stores.

Updates included in a hotfix should be applied to all computers that host the
updated components. For example, you should run the same version of
Commerce Data Exchange: Synch Service at all stores and at headquarters.
Environments that run different versions of the same Retail component are not
supported. In some cases, deployed fixes will not be fully available until all
components included in the hotfix have been updated. For example, a Commerce
Data Exchange: Real-time Service update might also require a code change at
headquarters.

These steps are in addition to the processes described in the topics

 Apply updates and hotfixes at http://technet.microsoft.com/en-


us/library/hh335183.aspx and
 Apply updates to database, AOS, and clients at
http://technet.microsoft.com/en-us/library/hh538446.aspx

06 - 2
Module 6: Extensibility Deployment and Hotfix Update Considerations

Deployment Components
The types of computers that are used in a typical Microsoft Dynamics AX 2012 R3
Retail deployment are shown in the following table:

Deployment Types of computers


location
Head office  AOS computer with Retail headquarters component installed
 Database server

You must modify the Microsoft Dynamics AX database server


only if the settings for Microsoft SQL Server do not comply
with the Payment Card Industry (PCI) Data Security Standard.

 Communications server that hosts Commerce Data


Exchange: Real-time Service and Async Server.

If you prefer, you can have two communications servers, one


for each of these applications.

 Microsoft Dynamics AX client computers with Retail


headquarters component installed
 Retail Server, if you are using Modern POS
 Web servers that host the online store

Brick-and-  Computer that hosts the channel database and Async Client
mortar  Point of sale (POS) devices
stores

Correct planning before a system is deployed can minimize the downtime of the
system. The deployment should be conducted in the following environments
before the system is deployed in the production environment.

Test environment – This is the environment where Microsoft Dynamics AX POS


customizations and solutions, possibly from different vendors, are deployed,
integrated, and tested.

Staging or pre-production environment – This is the 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 – This is the final environment that customers use to


run their business.

06 - 3
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

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. At the store, bring offline registers online and make sure that offline
transactions have been synchronized with the store database. [Note :
If you skip this step, severe data damage and possible financial losses
can occur. After you upgrade the store database, you can no longer
synchronize transactions from existing offline databases]
2. Run P jobs to synchronize local transactions with headquarters. For
more information, refer to “Schedule and run jobs in Retail
Scheduler.”
3. 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, and install binary updates to
non-database and database components. Then, if you have customized Retail
POS, you must re-merge your code changes to services and triggers, compile, and
re-deploy.

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 topic “Deploy
Updates in a Retail Environment”- http://technet.microsoft.com/en-
us/library/dn305851.aspx

06 - 4
Module 6: Extensibility Deployment and Hotfix Update Considerations

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 corresponding files will be available in
the updated Retail Software Development Kit (SDK) folder. By default, the files will
be located in C:\Users\...\Documents\Retail SDK\POS Plug-ins\.

If you have customized Retail POS, you must re-merge your code changes to
services and triggers, compile, and then re-deploy the customized assemblies.

For more information about how to handle customizations in an update, see the
blog post AX for Retail: Managing and Maintaining POS Customizations
http://blogs.msdn.com/b/axsupport/archive/2013/07/08/ax-for-retail-managing-
and-maintaining-pos-customizations.aspx from the Microsoft Dynamics AX
Support team.

Merging Code from ISV

If you have an Independent Software Vendor (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.

06 - 5
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

Update the Retail Channel Configuration


Utility (Retail Store Database Utility) on
one computer
If a retail database update is included in the update that you are applying, an
updated version of the Retail Channel Configuration Utility is included in the
update.

Note: In AX 2012 R2 and AX 2012 Feature Pack, the Retail Channel Configuration
Utility is called the Retail Store Database Utility.

At the store, start by updating the Retail Channel Configuration Utility on one
computer. If other Retail software is installed on this computer, you can also
update that software.

o Browse to the location where you extracted the files for the update, and then
double-click AxUpdate.exe.
o Install updates.

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

Upgrade the store database by using the


Retail Channel Configuration Utility
(Retail Store Database)
If an update includes a schema change, the updated version of Retail POS will not
run until the store database has been upgraded.

To upgrade retail databases, you must run an updated version of the Retail
Channel Configuration Utility. Upgrade the store database before you upgrade
offline databases on POS registers.

1. Start the Retail Channel Configuration Utility.

2. Enter the information for the store database and then click Apply or Continue.

Database upgrade scripts are executed. If there is an offline database on the


computer where the utility is installed and run, you are prompted to provision
again, and then the offline database is also upgraded.

06 - 6
Module 6: Extensibility Deployment and Hotfix Update Considerations

Apply updates on remaining computers


and upgrade offline databases
After the store database has been updated, you can upgrade offline databases
and update all other retail software at the store.

Caution: It can take several hours to upgrade offline databases. Offline mode is
not available until the store database has been provisioned and an offline
database has been created on at least one register. If your environment relies
heavily on offline mode, consider these factors when you plan the update.

1. On each computer in the environment, including POS registers, update all


Retail components that are offered in the hotfix installer. This ensures that the
local copy of the Retail Channel Configuration Utility is updated with the latest
offline database schema.

2. On each computer where offline mode will be available, run the Retail Channel
Configuration Utility to upgrade offline databases

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.”
[http://technet.microsoft.com/en-us/library/hh335183.aspx ]

06 - 7
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

Module Review

Module Review and Takeaways


This module explained the following:

 How to merge a POS customization with a POS hotfix.

 How to install updates to a database and non-database retail components.

 How to install updates to CDS: Real-time service.

Test Your Knowledge


Test your knowledge with the following questions.

1. Which areas should be considered to merge the POS code hotfix?

2. Which tool is used to deploy POS database updates?

06 - 8
Module 6: Extensibility Deployment and Hotfix Update Considerations

Test Your Knowledge Solutions


MODEL ANSWER:

1. Customized and ISV code


2. Retail Database Utility

06 - 9
Module 7: LAB – MPOS - Extensibility

Objective of this lab


In this lab, you will learn the following:
1. Extend CDX, CRT and Ecommerce and MPOS to collect Email of the Customer..

Extending Commerce DB, CRT and Retail Server


Scenario

Allow call center users using Dynamics AX 2012 R3 to collect/modify customer’s email
preference

Extend Dynamics AX database to store email preference


1. Extend Dynamics AX 2012 R3 customer form to collect/update email preference
2. Configure CDX Async to send email preference to channels

Detailed Steps
Create a new Dynamics AX 2012 R3 table
1. Launch to Dynamics AX 2012 R3 , go to (press Ctrl+Shift+W) AOT > Data Dictionary
> Tables
2. Create a new table RetailCustPreference
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

3. Create a new field EmailOptIn as enum NoYes


4. Create a new relationship with CustTable
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

5. Add a PrimaryKey based foreign key to the CustTable relation, and set the
SourceEDT as CustAccount, rename the newly created field CustTable to
AccountNum

6. Set the ExtendedDataType of field AccountNum as CustAccount, and Mandatory


as Yes
7. Save the changes and click Synchronize to sync the changes to database
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

8. Generate the CIL code for the new table by clicking Compile
9.

Extend Form CustTable

10. Launch to Dynamics AX 2012 R3 , go to AOT > Forms > CustTable


11. Add RetailCustPreference as a Data Source with JoinSource as CustTable and
LinkType as OuterJoin

12. Add a new UI group named CustomerPreference with Caption as Customer


Preference to CustTable form under Retail fasttab
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

13. Add a new field EmailOptIn from table RetailCustPreference within the
CustomerPreference group
14. Update method CustTable: write to set retailCustPreference.AccountNum =
custTable.AccountNum;

15. Update method CustTable: validateWrite to set retailCustPreference.AccountNum


= custTable.AccountNum;

16. Save and compile the changes


Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

17. Go to Accounts receivable > Common > Customers > All customers, edit a
customer record, go to Retail fasttab, check Email Opt In checkbox, and save.

Configure CDX Asycn

18. Launch to Dynamics AX 2012 R3 , go to Retail > Setup > Retail scheduler, open Retail
channel schema, and select AX 2012 R3

19. Create a new Location tables with table name as ax.RETAILCUSTPREFERENCE


20. Add four Location fields, ACCOUNTNUM, EMAILOPTIN, RECID
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

1. Create a new subjob RetailCustPreference with the following highlighted data by going to Retail
> Setup > Retail scheduler > Scheduler subjobs form

2. On Schedular subjob form, click Transfer field list to open the Field list form

3. On the Field list form, click Functions > Match fields to generate all matching fields.
4. Go to Retail > Setup > Retail scheduler, open Retail channel schema, and select AX 2012 R3,
in the Retail data distribution fasttab, add the following highlighted RetailCustPreference
definition to the Table distribution
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

<Table name="CustTable">
<LinkGroup>
<Link type="FieldMatch" fieldName="Party" parentFieldName="RecId" />
</LinkGroup>
<Table name="RetailCustPreference">
<LinkGroup>
<Link type="FieldMatch" fieldName="AccountNum" parentFieldName="AccountNum"
/>
</LinkGroup>
</Table>
<Table name="RetailCustTable">
<LinkGroup>
<Link type="FieldMatch" fieldName="accountNum" parentFieldName="AccountNum"
/>
</LinkGroup>
</Table>
</Table>

5. Add subjob RetailCustPreference to job 1010 by going to Retail > Setup > Retail scheduler >
Scheduler jobs form
6. Click Generate classes to generate needed CDX Async classes
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

Extend mobile POS to collect email preferences


Scenario

Allow mobile POS to collect/modify customer’s email preference.

Task Overview
1. Extend channel database to store email preference
2. Configure CDX Async services to send email preference to channels
3. Extend Commerce Runtime and Retail Server to read/save email preference
4. Extend CDX real-time service to save email preference to central DYNAMICSAX 2012 R3
5. Extend mobile POS user interface to collect email preference

Detailed Steps

Extend channel database to store email preference

1. Launch to SQL Server Management Studio, connect to local SQL server


2. Create a new table [ax].[RETAILCUSTPREFERENCE] for databases RetailHoustonStore,
RetailContosoStorefront, RetailBostonStore, RetailFabrikamStorefront, RetailNewYorkStore,
RetailParisStore, and RetailSeattleStore with the following SQL script

/****** Object: Table [ax].[RETAILCUSTPREFERENCE] Script Date: 01/24/2014 17:36:42 ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

CREATE TABLE [ax].[RETAILCUSTPREFERENCE](

[DATAAREAID] [nvarchar](4) NOT NULL,

[RECID] [bigint] NOT NULL,

[EMAILOPTIN] [int] NOT NULL,

[ACCOUNTNUM] [nvarchar](20) NOT NULL,

CONSTRAINT [I_103992RECID] PRIMARY KEY CLUSTERED


(

[RECID] 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

ALTER TABLE [ax].[RETAILCUSTPREFERENCE] WITH CHECK ADD CHECK (([RECID]<>(0)))

GO

ALTER TABLE [ax].[RETAILCUSTPREFERENCE] ADD DEFAULT ('dat') FOR [DATAAREAID]

GO

ALTER TABLE [ax].[RETAILCUSTPREFERENCE] ADD DEFAULT ((0)) FOR [EMAILOPTIN]

GO

ALTER TABLE [ax].[RETAILCUSTPREFERENCE] ADD DEFAULT ('') FOR [ACCOUNTNUM]

GO

3. Alter ax.CUSTOMERVIEW to return EMAILOPTIN data for databases RetailHoustonStore,


RetailContosoStorefront, RetailBostonStore, RetailFabrikamStorefront, RetailNewYorkStore,
RetailParisStore, and RetailSeattleStore with the following SQL script

/****** Object: View [crt].[CUSTOMERSVIEW] Script Date: 1/27/2014 6:54:07 PM


******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

ALTER VIEW [crt].[CUSTOMERSVIEW] AS

SELECT

ct.ACCOUNTNUM AS ACCOUNTNUMBER,

ct.RECID,

ct.CREATEDDATETIME,

dpt.RECID AS PARTY,

dpt.NAME,

dpn.RECID AS PERSONNAMEID,

dpn.FIRSTNAME,

dpn.MIDDLENAME,

dpn.LASTNAME,

dpt.PARTYNUMBER,

dpt.INSTANCERELATIONTYPE,

ceap.LOCATOR PHONE,

ceap.LOCATOREXTENSION PHONEEXT,

ceap.RECORDID PHONERECORDID,

ceae.LOCATOR EMAIL,

ceae.RECORDID EMAILRECORDID,

ceau.LOCATOR URL,

ceau.RECORDID URLRECORDID,

ceacp.LOCATOR CELLPHONE,

ceacp.RECORDID CELLPHONERECORDID,
rct.RECEIPTEMAIL RECEIPTEMAIL,

dpt.LANGUAGEID AS LANGUAGE,

ct.DATAAREAID,

rct.RECID RETAILCUSTOMERRECID,

ct.CURRENCY,

ct.INVOICEACCOUNT,

ct.CREDITMAX,

ct.ONETIMECUSTOMER,

ct.MARKUPGROUP,

ct.PRICEGROUP,

ct.CUSTGROUP,

ct.BLOCKED,

ct.ORGID,

ct.MULTILINEDISC,

ct.USEPURCHREQUEST,

ct.LINEDISC,

ct.INCLTAX,

ct.ENDDISC,

ct.TAXGROUP,

ct.CREDITRATING,

ct.TAXLICENSENUM,

ct.VATNUM,

ct.IDENTIFICATIONNUMBER

, isnull(rcp.EMAILOPTIN, 0) as EMAILOPTIN

FROM [ax].CUSTTABLE ct

JOIN [ax].DIRPARTYTABLE dpt ON ct.PARTY = dpt.RECID


Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

LEFT OUTER JOIN ax.RETAILCUSTTABLE rct ON ct.ACCOUNTNUM =


rct.ACCOUNTNUM AND ct.DATAAREAID = rct.DATAAREAID

LEFT OUTER JOIN ax.DIRPERSONNAME dpn ON dpt.RECID = dpn.PERSON AND


(GETUTCDATE() BETWEEN dpn.VALIDFROM AND dpn.VALIDTO)

-- phone

LEFT OUTER JOIN [crt].CUSTOMERELECTRONICADDRESSESVIEW ceap ON dpt.RECID


= ceap.DIRPARTYRECORDID

AND ceap.METHODYTPE = 1 AND ceap.ISPRIMARY = 1 AND


ceap.PARENTLOCATION = 0

-- email

LEFT OUTER JOIN [crt].CUSTOMERELECTRONICADDRESSESVIEW ceae ON dpt.RECID


= ceae.DIRPARTYRECORDID

AND ceae.METHODYTPE = 2 AND ceae.ISPRIMARY = 1 AND


ceae.PARENTLOCATION = 0

-- url

LEFT OUTER JOIN [crt].CUSTOMERELECTRONICADDRESSESVIEW ceau ON dpt.RECID


= ceau.DIRPARTYRECORDID

AND ceau.METHODYTPE = 3 AND ceau.ISPRIMARY = 1 AND


ceau.PARENTLOCATION = 0

-- cellphone

LEFT OUTER JOIN [crt].CUSTOMERELECTRONICADDRESSESVIEW ceacp ON


dpt.RECID = ceacp.DIRPARTYRECORDID

AND ceacp.METHODYTPE = 1

AND ceacp.ISPRIMARY = 0

AND ceacp.ISMOBILEPHONE = 1

-- email preference

LEFT OUTER JOIN ax.RETAILCUSTPREFERENCE rcp on ct.ACCOUNTNUM =


rcp.ACCOUNTNUM AND ct.DATAAREAID = rcp.DATAAREAID

)
GO

4. Alter [crt].[CREATEUPDATECUSTOMER] to save MAILOPTIN to table ax.RetailCustPreference


table for databases RetailHoustonStore, RetailContosoStorefront, RetailBostonStore,
RetailFabrikamStorefront, RetailNewYorkStore, RetailParisStore, and RetailSeattleStore with
the following SQL script
Add the following SQL script after the upsert for table RETAILCUSTTABLE

-- HOL

MERGE INTO [ax].RetailCustPreference


USING (SELECT DISTINCT
tp.PARENTRECID, tp.PROPERTYVALUE as [EMAILOPTIN], ct.AccountNum, ct.DataAreaID
FROM @TVP_EXTENSIONPROPERTIESTABLETYPE tp
JOIN ax.CustTable ct on ct.RECID = tp.PARENTRECID
WHERE tp.PARENTRECID <> 0 and tp.PROPERTYNAME = 'EMAILOPTIN') AS SOURCE
ON [ax].RetailCustPreference.RECID = SOURCE.PARENTRECID
and [ax].RetailCustPreference.DataAreaID = SOURCE.DataAreaID
and [ax].RetailCustPreference.ACCOUNTNUM = SOURCE.ACCOUNTNUM
WHEN MATCHED THEN
UPDATE SET [EMAILOPTIN] = source.[EMAILOPTIN]
WHEN NOT MATCHED THEN
INSERT
(
RECID
,DATAAREAID
,EMAILOPTIN
,ACCOUNTNUM
)
VALUES
(
SOURCE.PARENTRECID
,SOURCE.DATAAREAID
,SOURCE.EMAILOPTIN
,SOURCE.AccountNum
);

SELECT @i_Error = @@ERROR;


IF @i_Error <> 0
BEGIN
SET @i_ReturnCode = @i_Error;
GOTO exit_label;
END;

-- HOL
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

Send customer data to channels

1. Launch to Dynamics AX 2012 R3 , go to Retail > Periodic > Data distribution > Distribution
schedule, run job 1010 Customers to send data to channels
Extend mobile POS to add email preference on the customer edit page

1. Go to C:\Microsoft Dynamics\Retail SDK\POS Clients\Windows\C1, lanuch Visual Studio 2012


and open POS.sln Windows 8 POS project
2. Add the following two UI resource texts in POS\Assets\Strings\en-US\resources.resjson under
section CUSTOMERADDEDIT RESOURCES . RANGE: [1300 - 1399]
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

a. Add the following code to the contractor of class CustomerAddEditViewModel

// HOL
this.emailOptIn = ko.observable(false);

this.emailOptIn.subscribe((newEmailOptIn) => {
//if (this._emailOptInProperty && this._emailOptInProperty.Value) {
// this._emailOptInProperty.Value.IntegerValue = (newEmailOptIn ? 1 : 0);
//}
this.addUpdateExtensionProperty(this._emailOptIn_Key, (newEmailOptIn ? 1 :
0));
});
// HOL
b. Add the following method to class CustomerAddEditViewModel

// HOL
private addUpdateExtensionProperty(key: string, intValue: number) {

if (this.CustomerProxy) { if
(!this.CustomerProxy.ExtensionProperties()) {
this.CustomerProxy.ExtensionProperties = ko.observableArray([]);
}

var properties = this.CustomerProxy.ExtensionProperties().filter((property) =>


{
return property.Key === key;
});

var emailOptInP: Model.Entities.CommercePropertyClass;


if (ArrayExtensions.hasElements(properties)) {
emailOptInP = properties[0];
}
else {
emailOptInP = new Model.Entities.CommercePropertyClass();
emailOptInP.Key = key;
this.CustomerProxy.ExtensionProperties().push(emailOptInP);
}

if (!emailOptInP.Value) {
emailOptInP.Value = new Model.Entities.CommercePropertyValueClass();
}

emailOptInP.Value.IntegerValue = intValue;
}
}
// HOL

c. Add the following code in the call back of


this.customerManager.getCustomerDetailsAsync in method
CustomerAddEditViewModel.LoadCustomer

// HOL
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

var properties = customer.ExtensionProperties.filter((property) => {

return property.Key === this._emailOptIn_Key;

});

if (ArrayExtensions.hasElements(properties)) {

var emailOptInProperty= properties[0];

if (emailOptInProperty.Value) {

this.emailOptIn(emailOptInProperty.Value.IntegerValue === 1);

// HOL

3. Extend the customer page to add email preference in


Views\Customer\CustomerAddEditView.html under the Phone number section
<!-- HOL: Email preference -->

<div>

<br />

<input tabindex="8" type="checkbox" id="specialOfferTabRead"

data-bind="checked: customerAddEditViewModel.emailOptIn"/>

<label for="specialOfferTabRead" data-bind="resx: { textContent: 'string_1366' }">Receive special


offers?</label>

</div>

4. Build the project by going to BUILD > Build Solution in Visual Studio 2012
5. Create a package by selecting POS project, then go to menu PROJECT > Store > Create App
Packages…,
select No
Microsoft Dynamics® AX 2012 R3 for Retail in Brick in Brick and Mortar
Stores: Development and Customization

Follow the steps and enter needed info, click Create to create the package
6. Deploy the package location to deploy the package
Go to ..\POS Clients\Windows\C1\AppPackages\RetailModernPOS_x64_Test, right click Add-
AppDevPackage.ps1 and select Run with PowerShell, and follow the steps to complete the
deployment

Test your app

Das könnte Ihnen auch gefallen