You are on page 1of 63

Epicor 9

Advanced Embedded
Customization Course
9.05.600

Disclaimer
Copyright 2010 by Epicor Software Corporation. All rights reserved. Printed in the United States of America. No part
of this publication may be reproduced in any form without the prior written consent of Epicor Software Corporation.
Epicor, Vantage, and Vista are registered trademarks of Epicor Software Corporation. All other trademarks are property
of their respective owners. Microsoft product screen shots reprinted with permission from Microsoft Corporation.
Epicor Software Corporation makes no representations or warranties with respect to the contents of this document
and specifically disclaims any implied warranties of merchantability, satisfactory quality or fitness for any particular
purpose. The contents of this document are believed to be current and accurate as of its date of publication. Changes
to this document between reprintings and other important information about the software product are made or
published in release notes, and you are urged to obtain the current release notes for the software product. We welcome
user comments and reserve the right to revise this publication and/or make improvements or changes to the products
or programs described in this publication at any time without notice. The usage of any Epicor Software shall be pursuant
to an Epicor end user license agreement and the performance of any consulting services by Epicor personnel shall be
pursuant to Epicor's standard services terms and conditions.

ED837905
90521-905-9205-583600B
9.05.600

TOC | 3

Contents
Advanced Embedded Customization Course........................................................................5
Before You Begin....................................................................................................................6
Audience.........................................................................................................................................................6
Prerequisites....................................................................................................................................................6
Environment Setup..........................................................................................................................................7
Workshop Constraints..............................................................................................................................7

Customization Overview........................................................................................................9
The Script Editor Feature................................................................................................................................10
Script Editor Context Menu............................................................................................................................11
Event Handlers...............................................................................................................................................11
Workshop - Review the Script Editor..............................................................................................................14
Launch a Customization.........................................................................................................................14
Review the Default Script........................................................................................................................15
Identify Scripting Regions........................................................................................................................16
Use the Test Code Feature......................................................................................................................17

The Customization Tool Set.................................................................................................18


ToolBox.........................................................................................................................................................18
Workshop - Add the PictureBox Control.................................................................................................20
Create a PictureBox.........................................................................................................................20
Set Up the Handler for the PictureBox..............................................................................................21
Author a Routine.............................................................................................................................22
Add the Image and Test the Part.....................................................................................................23
Assembly Reference Manager........................................................................................................................24
Workshop - Create Assembly References................................................................................................26
Workshop - Automatically Generate the Assembly Reference..................................................................27
Custom Object Explorer.................................................................................................................................28
Workshop - Review the Custom Object Explorer.....................................................................................29
Access the Custom Object Explorer..................................................................................................29
Review EpiTransaction Objects.........................................................................................................29
Review Session Objects....................................................................................................................30
Review the ICustomScriptManager Object.......................................................................................30
Review EpiDataView Objects............................................................................................................31
Review Adapters..............................................................................................................................33
Options Menu................................................................................................................................................34
Custom XML Editor........................................................................................................................................34
Data Tools.....................................................................................................................................................34

Custom Code Wizards..........................................................................................................36


Workshop - Use the Business Logic Assembly Reference Wizard.....................................................................37
Workshop - Use the Extended Property Wizard..............................................................................................39
Launch the Customization......................................................................................................................39

Epicor 9 | 9.05.600

4 | Advanced Embedded Customization Course


Launch The Extended Property Wizard....................................................................................................39
Test the Custom Code............................................................................................................................40
Workshop - Use the Add User Defined Table as Child Wizard.........................................................................41
Launch the Customization......................................................................................................................41
Test the User-Defined Wizard.................................................................................................................42
Workshop - Use the Business Logic Method Call Wizard.................................................................................43
Use the Business Logic Method Call Wizard............................................................................................43
Author a Routine....................................................................................................................................44
Add an EpiNotificationEvent...................................................................................................................45

Code Examples......................................................................................................................47
UI Controls and Form Events..........................................................................................................................47
Workshop - Work with Embedded Dashboards.......................................................................................48
Add a New Sheet............................................................................................................................48
Define the Publish and Subscribe Options of the Dashboard............................................................49
Modify Infragistics Components...................................................................................................................50
Modifying Sub Processes................................................................................................................................51
Workshop - Modify Sub Processes..........................................................................................................52
Identify the Sub Process...................................................................................................................52
Customize the Memo Window........................................................................................................52
Create the Sub Process....................................................................................................................53
Create the Process Calling...............................................................................................................54
Test the New Sub Process................................................................................................................54
Delete the Sub Process....................................................................................................................55

Tracing Options.....................................................................................................................56
Workshop - Create the Tracing Log................................................................................................................57
Configure and Start a Trace Log.............................................................................................................57
Create an XML Trace Report...................................................................................................................57
Disable Tracing.......................................................................................................................................58

Customization/Personalization Maintenance.....................................................................59
Workshop - Use Customization/Personalization Maintenance.........................................................................61
Export a Customization...........................................................................................................................61
Import a Customization File....................................................................................................................61
Review and Verify the Imported Customization File.................................................................................62

Conclusion.............................................................................................................................63

Epicor Software

Advanced Embedded Customization Course | 5

Advanced Embedded Customization Course


This course provides customization techniques that reach beyond the basics of text boxes and grids. It explores how
to further customize a program through its code using the C# or VB.NET programming languages. It also introduces
several wizards to create custom code without requiring knowledge of the programming languages.
Embedded customization is the ability to modify aspects of your interface and application functionality. This includes
the ability to model changes, track changes, pilot changes, and deploy and rollout changes to the user community.
Upon successful completion of this course, you will be able to:
Differentiate between personalization and customization (or server-side) tools.
Locate the methods and properties of a common business objects in the Object Explorer.
Identify the essential toolset available to assist in creating embedded customizations and custom code.
Use the Form Event Wizard to create a simple routine and assign it to the appropriate event handler.
Generate a sub-process customization and identify a process call for that sub-process.
Use the Script Editor to evaluate the parts of a User Interface (UI) script and understand the appropriate placement
for customized code entry.
Understand common data objects and methods you need to complete typical customizations.
Use the Sheet Wizard to embed a dashboard into a form.
Use Tracing Options to explore the business objects referenced by a program.
Use Customization Maintenance to verify the controls and code associated with a specific customization.

Epicor 9 | 9.05.600

6 | Advanced Embedded Customization Course

Before You Begin


Read this topic for information you should know in order to successfully complete this course.

Audience
Specific audiences will benefit from this course.
System Administrator
IT/Technical Staff

Prerequisites
In order to complete the workshops in this course, all necessary modules must be licensed and operating in your training
environment. For more information on the modules available, contact your Epicor Customer Account Manager
EpicorCAM@epicor.com. It is also important that you understand the prerequisite knowledge contained in other valuable
courses.
Navigation Course - This course introduces navigational aspects of the Epicor application's user interface. Designed
for a hands-on environment, general navigation principles and techniques are available at each of the interface
levels in the Epicor application - system, module, and program. Workshops focus on each of these levels and guide
you through each navigational principle introduced.
Personalization Course - This course covers how to personalize the Epicor application by adjusting the views,
options, and toolbars to best suit your business needs. This course focuses on the personalization tools available to
all users, regardless of security privileges.
Advanced Personalization - This course shows you how to personalize your Epicor application in a way that best
suits your company's needs. It introduces the changes you can make to the layout and content that does not affect
the actual data or minimum mandatory requirements of the Epicor application. These features are specific to users
with Personalization security privileges.
Embedded Customization Course - This course covers all aspects of the customization model which is built into
the framework for Epicor 9 and beyond. Users may personalize their environment if given the authority. This course
goes beyond the personalization aspects to allow system administrators to deploy standard customizations based
on their specific business requirements. This includes adding and removing data elements, modifying component
properties, adding VBScript "code points" to run before and after data field modifications, and much more.
Database Concepts Course - This course reviews the table and field name identification process using Field Help,
Customization Tools, and the Data Dictionary Viewer functionality. It also describes table linking procedures and
requirements, Dataset Relationships Tracker features, and join type definitions and specifications.
Some of the material in this course addresses object oriented programming conventions and specifically, VB.Net
and C# programming language syntax to author code. The following can be useful as additional study materials:
A general reference or text on Object Oriented concepts.
A language reference for Visual Basic, Visual Basic .NET, or C#.
Previous coursework in .NET framework with a concentration in namespaces.
Additional information from Microsoft Developer's Network.
Epicor Software

Before You Begin | 7


The Epicor ICE User Experience and Customization Guide available from any Customer Account Manager.

Environment Setup
The environment setup steps and potential workshop constraints must be reviewed in order to successfully complete
the workshops in this course.
Your Epicor training environment, in which the Epicor demonstration database is found, enables you to experience
Epicor functionality in action but does not affect data in your live, production environment.
The following steps must be taken to successfully complete the workshops in this course.
1.

Verify the following or ask your system administrator to verify for you:
Your Epicor training icon (or web address if you are using Epicor Web Access) points to your Epicor
training environment with the Epicor demonstration database installed. Do not complete the course
workshops in your live, production environment.
Note It is recommended that multiple Epicor demonstration databases are installed. Contact Support
or Systems Consulting for billable assistance.
The Epicor demonstration database is at the same service pack and patch as the Epicor application.
Epicor's education team updates the Epicor demonstration database for each service pack and patch. If your
system administrator upgrades your Epicor application to a new service pack or patch, he or she must also
download the corresponding Epicor demonstration database from EPICweb > Support > Epicor > Downloads
and install it. If this is not performed, unexpected results can occur when completing the course workshops.
Your system administrator restored (refreshed) the Epicor demonstration database prior to starting
this course. The Epicor demonstration database comes standard with parts, customers, sales orders, and so
on, already defined. If the Epicor demonstration database is shared with multiple users (that is, the database
is located on a server and users access the same data, much like your live, production environment) and is not
periodically refreshed, unexpected results can occur. For example, if a course workshop requires you to ship a
sales order that came standard in the Epicor demonstration database, but a different user already completed
this workshop and the Epicor demonstration database was not restored (refreshed), then you will not be able
to ship the sales order. Epicor's education team has written the course workshops to minimize situations like
this from occurring, but Epicor cannot prevent users from manipulating the data in your installation of the
Epicor demonstration database.

2.

Log in to the training environment using the credentials manager/manager. If you are logged in to your training
environment as a different user, from the Options menu, select Change User.

3.

From the Main menu, select the company Epicor USA (EPIC03).

4.

From the Main menu, select the Main Plant.

Workshop Constraints
Below is a list of workshops in this course that can be performed only once in each instance of a restored (refreshed)
database. Where applicable, a detailed explanation of the workshop constraints is documented in the workshop itself.
Workshop - Create the Tracing Log

Epicor 9 | 9.05.600

8 | Advanced Embedded Customization Course


For the purpose of this course, it is important to follow all of the steps provided in each workshop. While this course
provides education on the customizing functionality, it is essential that any activated customizations in the course are
deactivated or removed. Removing these customizations ensures the appropriate default training environment is
available.

Epicor Software

Customization Overview | 9

Customization Overview
Five layers make up the Epicor Customization model but only two are available for modification: Personalization and
Customization. These layers are considered the User Interface (UI) and modifications to these layers affect how screens
display. The difference between the two UI layers is that Personalization follows the user ID and Customization follows
the company and the module.
Customization allows you to change the UI permanently and roll it out to the entire company. Use the Business Process
Management (BPM) module to incorporate modifications to the business logic to enhance changes to the UI. This tool
allows you to create custom routines you can execute before or after the execution of business objects used in a
program.
Selecting the Tool
The Epicor application provides a number of powerful tools that assist in the customization of both the client side
interface as well as the server logic that governs the use of the business objects accessed by each form. In addition,
the modification can entail the consumption and use of information from systems outside the application. Selecting
the appropriate tool to create the customization is perhaps the most crucial step in the modification process because
the tool carries with it both a series of benefits and constraints.
In general, the appropriate tool set to select is Business Process Management (BPM) for server-side modifications
that adjust or circumvent the established order and functionality of the business objects accessed by a particular form.
Conversely, for modifications that require UI changes and the enforcement of other rules at the time of data entry or
retrieval in the UI, Embedded Customization is the best choice. Finally, when retrieving, consuming, and publishing
data from the manufacturing application to external applications, Service Connect can provide the most appropriate
solution to build the workflow necessary to accommodate data transactions of this type.
This course focuses on the embedded customization (EC) capability which applies solely to the ability to modify user
interface components. EC modifications, which save to the server, affect only the client side display and logic.
Example A common example is the need to make certain fields in the Epicor application mandatory that the
application does not require as purchased. While this modification at first might make sense using EC, remember
that the enforcement of data entry into a specific field on the UI ensures everyone is required to enter data in
the field. Any external applications (such as web services enabled forms) do not observe the client side
modification. In this case, the tool of preference is Business Process Management.
Business Process Management or Embedded Customization?
The term advanced customization is perhaps too vague in scope. It implies an extension to any type of modification
you can accomplish within the Epicor application that significantly impacts the way a business object might function.
While this course exclusively focuses on the embedded customization tool set in the application, the Business Process
Management (BPM) module allows you to create custom routines. You can execute custom routines before, after, or
at the same time as the execution of the business objects in the application. BPM employs method directives you can
author within the application using the Progress 4GL code and the BPM method directive wizard that assists you in
setting up triggers for actions. For more information and training on the BPM functionality and server-side modifications
that affect the business logic of the application, refer to the Business Process Management course.
Non-Customizable Forms
Some programs, or forms, within the Epicor application cannot be customized. This security condition is placed on
programs that contain sensitive system level functions. If customizations were made to these programs, they could
harm the performance and function of the application. For example, you cannot customize the Business Activity Query
Designer program.

Epicor 9 | 9.05.600

10 | Advanced Embedded Customization Course


You are immediately prevented from customizing a non-customizable form. Normally when you launch a program in
Developer mode, the Select Customization window displays and you can pull in an existing customization or create a
new one. A dialog box displays instead, informing you that this form is not customizable. Click OK and the form displays
in Run mode. If you click on the Tools menu, the Customization option is not available.

The Script Editor Feature


The Script Editor is a complete development environment. It includes tools that allow you to enter, format, and test
code. You can enter code directly in the Script Editor or use the Customization Code Wizards.
The original code of a form displays along with the code from any previously created customizations. Everything about
the form displays within this tool. Use the Script Editor to make code level customizations to the current form.
Below are key elements of the Script Editor:
The Interface - When you open the Script Editor, the code for the current program displays. The interface explains
how to navigate within the Script Editor.
The Context Menu - To help you create custom code, the Script Editor has a context menu that contains a variety
of additional functions.
Script Editor Basic Code - All form scripts have default sections. These are explained in the following workshop.
Script Editor Event Handlers - An event handler is a special method you can use to run code at particular times.
Some useful methods are listed below.
GetNativeControl
Use this method to retrieve a reference to base control on the form. This method requires a string parameter controlGUID which is the unique identifier for the specific control. The following line of code demonstrates general
coding conventions:
Dim ctrl As Control =
csm.GetNativeControlReference(5483cdef-3049-4705-b597-28ae93bc7fdf)
The example below shows use of the method when casting to a specific control type:
Dim eucSales As EpiUltraCombo =
CType(csm.GetNativeControlReference(5483cdef-3049-4705-b597-28ae93bc7fdf),
EpiUltraCombo)
AddForeignKeyView
Use this method to add an undatable ForeignKeyView to the EpiTransaction object. Once this method is called, the
added ForeignKey is available for control binding. This method is used in conjunction with business logic adapters. Use
of this method requires the following parameters:
1.

ViewName (String) - This is the ForeignKeyView name and must be unique.

2.

dsData (DataSet) - This is an empty DataSet of the Foreign Key Views Type.

3.

TableName (String) - This represents the table name that corresponds to the view in the DataSet.

The following lines of code demonstrate the use of this method:


'// Add Adapters Table to List of Views
'// This allows you to bind controls to the custom child view
Dim dsData As DataSet = CType(ud01Adapter.UD01Data, DataSet)

Epicor Software

Customization Overview | 11
Dim fkvUD01 As ForeignKeyDataView = csm.AddForeignKeyView(MyUD01View, dsData,
UD01)
NotifyForeignKeyView Method
Use this method to update a ForeignKeyView added by the AddForeignKeyView() method. This method notifies controls
bound to the ForeignKeyView that the data has changed. This method is almost always used in conjunction with
business logic adapters. Use of this method requires the same parameters as the AddForeignKeyView method. The
following lines of code demonstrate the use of this method:
'// notify with updated data
csm.NotifyForeignKeyView("UD01", CType(ud06Adapter.UD01Data, DataSet), "UD01")

Script Editor Context Menu


The Script Editor has a context menu that contains various additional functions that help you create custom code.
Besides default standards such as cut, copy, and paste, the context menu also has default options that can help you
both enter and keep custom code standard. Use these options to perform actions such as tab, comment, bookmark,
and so on.
You can access the right-click menu directly inside the Script Editor. The following sub-menus are included in the menu
options:
Edit Menu - This menu offers quick access to Edit, Cut, Paste, and other editing tools.
File Menu - This menu allows you to quickly access the New, Open, Close, Save, and Save As options to record
your customization in stages. This way, if you have problems with a new version of custom code, you can always
restore a previous version that works correctly.
Advanced Menu - This menu includes several options to assist you in the creation of custom code.
Bookmarks - Bookmarks set quick access points in a lengthy script.
Options Menu - This menu defines how the Script Editor displays custom code or how to establish the coding
environment.

Event Handlers
Event Handlers are special methods you can use to run code at particular times.
Example An event handler is called when you open and close a User Interface application, when certain events
relative to the data occurs, or when a business logic call occurs. These methods listen for events fired by objects
in the application.
In addition, event handlers are extremely common methods you can use to establish active listeners for specific events.
These objects (methods + data) are available to programs throughout the Epicor application using the custom coding
engine and are passed to custom assembly when the UI opens.
InitializeCustomCode()
This is the first method called in custom Code Initialize module level variables. It can create custom EpiDataViews and
add them to the transaction object.

Epicor 9 | 9.05.600

12 | Advanced Embedded Customization Course


Note Wizards also put variable initializations and method calls in this method.

The InitializeCustomCode() handler does the following:


Initializes module level variables.
Creates custom EpiDataViews and adds them to the Transaction Object.
The Form Event Wizard places variable code initializations and calls within this method.
The last method called in custom code is DestroyCustomCode(). It cleans up module level variables' Customization
wizards, such as the Rule Wizard. Both these methods are generated automatically and display in the Script Editor.
The DestroyCustomCode() handler does the following:
Cleans up any remaining module level variables.
The Form Event Wizard places variable code initializations and calls within this method.
[ViewName]_BeforeRowChanges() Handles EpiDataView.EpiRowChangingEvent Event
This event handler is called when changing rows of a multi-row EpiDataView. It is not triggered when a new EpiDataView
is loaded as this is triggered through the ListChanged event handler. It monitors changes in a row's data. If any data
changes occur, the event runs. If an EpiDataView is loaded, this event handler does not run.
[ViewName]_AfterRowChange() Handles EpiDataView.EpiRowChanged Event
This event handler is called after the existing row is changed. It does not fire when a new row is added or only one
row is present. This handler must be used in combination with ListChanged() and it does not run if you add a new row
to the grid.
[Table/ViewName]_BeforeFieldChange() Handles DataTable.ColumnChanging Event
This event handler is called before leaving a bound field. It can validate a specific field value and if not valid, the user
can be prevented from leaving the control until a legitimate value is entered.
To prevent users from leaving a field that is not validated, use the following code:
VB Code:
Throw New EpiUIException ()
When the Validation condition is not met
C# Code:
Throw new EpiUIException ();
When the Validation condition is not met
[Table/ViewName]_AfterFieldChange() Handles DataTable.ColumnChanged Event
This event handler is called after leaving a bound control. It can perform a call to another adapter and fill in data (similar
to validating a part and filling in a description).
This event handler does the following:
Runs a call to another adapter.
After it runs a call, it can then fill in data within the field.
[ViewName]_DataView_ListChanged() Handles DataView.Listchanged Event
This event handler is useful when only one row is present. It must be used in combination with AfterRowChanged().
Some UIs also have an AfterGetByID() method which can be used instead. This method is called frequently.

Epicor Software

Customization Overview | 13
This event handler does the following:
Validates the entered value.
If the value is not valid, then you can prevent the user from leaving the field until a correct value is entered.
Retrieve()
This event handler is called when you click the Retrieve button on the Standard toolbar. This button is added to the
toolbar if the EpiRetrieveToolName property is set for a panel. In the event handler code, args.ToolName is the value
that is set. Use this event handler if the data should refresh with data from the database.
[FormName]_Load() Called From End of EpiBaseForm_Load()
This is used for events that fire during the UI Form_Load() but after the InitilizeCustomCode() method runs.
[FormName]_Closing() Handles EpiBaseForm.Closing()
This event handler is used to clean up module level variables.
[ViewName]_EpiViewNotification() Handles
This event runs the EpiDataView.EpiViewNotification event. It is triggered just after a dataView is loaded into a program.
Essentially, this event signals the Epicor application to indicate data is ready for you to view and edit. It pre-populates
default values on GetNew. Examples might include unique ID generation in a UD table or default values generation.
AfterGetByID
Use this event handler to duplicate behavior. Customization Wizards do not generate code for this method.
oTrans_[AdapterName]_BeforeAdapterMethod()
This event handler runs just before an adapter runs. You can use it to validate data, check for required fields, and so
on. This method can be canceled which causes the corresponding AfterAdapterMethod call to cancel as well.
oTrans_[AdapterName]_AfterAdapterMethod()
This event handler handles the oTrans_ordAdapter.AfterAdapterMethod. It activates just after an adapter is executed
and performs the following:
Populates default values into a form.
Updates an external business object.
Runs the code just after a business layer call completes.
Event Sequences
Events execute in a specific order at start up or shutdown. When the form launches, events for the Startup Sequence
execute in the following order:
1.

InitializeCustomCode()

2.

[FormName]_Load()

When the form closes, events for the Shutdown Sequence execute in the following order:
1.

[FormName]_Closing

2.

DestroyCustomCode()

Epicor 9 | 9.05.600

14 | Advanced Embedded Customization Course

Workshop - Review the Script Editor


The Script Editor provides a text view of the custom code routine(s) used in a customization. If you use a Customization
Wizard to create an event or row rule, that code displays in the Script Editor. You can enter the code directly in the
Script Editor as required.
Important The workshop assumes the Developer Mode is active and you are logged in with appropriate
permissions to generate customizations.
Each form has a default code shell that initially displays within the Script Editor sheet. You can then add and edit this
shell to create code level programs within your customization.
This workshop is a tour of the Script Editor interface. The actual code and context menus are discussed in later workshops.

Launch a Customization
Navigate to Sales Order Entry.
Menu Path: Sales Management > Order Management > General Operations > Order Entry
1. In the Select Customization window, select the Base Only check box and click OK.
This check box is a safeguard for creating new customizations. Selecting it indicates the new customization is
based on the original code requirements of the forms, excluding any personalizations. It also protects the new
customization from being deployed to a menu before it is complete.
The Sales Order Entry form displays.
2. From the Tools menu, select Customization.
3. Navigate to the Script Editor sheet and maximize the window.
4. Review the interface as described below:
All Code - Use this check box to see all the code the framework generates in a display only mode.
Program Selection - The first decision you must make is whether to use the VB.NET or the C# program. Once
you make the decision and save the customization, all other modifications must be in the same language.
Current Sheet - This sheet displays all system and custom code. All lines of code are numbered.
Test Code - This option is available under the Tools menu. Use this option to verify the code compiles
successfully.
Comments - These are lines of text that define specific sections of code but are not part of the code itself. It
is recommended to use comments to describe custom code at all times. Below is a sample of comment lines
which always display in green on the screen.
Comments in C#:
// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module
Level Variables' Comments! *
// Begin Wizard Added Module Level Variables **
// End Wizard Added Module Level Variables **
// Add Custom Module Level Variables Here **
*
Comments in VB.NET:
'// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module
Level Variables' Comments! *

Epicor Software

Customization Overview | 15
'// Begin Wizard Added Module Level Variables **
'// End Wizard Added Module Level Variables **
'// Add Custom Module Level Variables Here **

Review the Default Script


1. In the Script Editor sheet, select the VB code option.
The following is the base display of code inside the Script Editor for a sales order form. It is divided into five sections
described in the following task.
'//**************************************************
'// Custom VB.NET code for SalesOrderForm
'// Created: 01/22/2010 12:28:03
'//**************************************************
SECTION 1
Imports System
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports Microsoft.VisualBasic
Imports Epicor.Mfg.UI
Imports Epicor.Mfg.UI.FrameWork
Imports Epicor.Mfg.UI.ExtendedProps
Imports Epicor.Mfg.UI.FormFunctions
Imports Epicor.Mfg.UI.Customization
Imports Epicor.Mfg.UI.Adapters
Imports Epicor.Mfg.UI.Searches
Imports Epicor.Mfg.BO
SECTION 2
Module Script
SECTION 3
'// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module
Level Variables' Comments! **
'// Begin Wizard Added Module Level Variables **
'// End Wizard Added Module Level Variables **
'// Add Custom Module Level Variables Here **
SECTION 4
Sub InitializeCustomCode()
'// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable
Intialization' lines **
'// Begin Wizard Added Variable Intialization
'// End Wizard Added Variable Intialization
'// Begin Wizard Added Custom Method Calls
'// End Wizard Added Custom Method Calls
End Sub

Epicor 9 | 9.05.600

16 | Advanced Embedded Customization Course

SECTION 5
Sub DestroyCustomCode()
'// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object
Disposal' lines **
'// Begin Wizard Added Object Disposal
'// End Wizard Added Object Disposal
'// Begin Custom Code Disposal
'// End Custom Code Disposal
End Sub

End Module

Identify Scripting Regions


Use the display of the script from the previous task or view it through the Script Editor.
The Base code can be divided into regions which are described below.
1. Review the top-most commented section.
This includes information on the date the customization script was created and the form in which it is located.
2. Examine SECTION 1:
Each of the import statements is used to import namespace. The Script Editor automatically imports the most
common namespace including the System namespace that includes the basic classes for .NET functionality. All
other namespaces are based on this System namespace.
3. Examine SECTION 2:
The Module Script begins the actual script that includes the system code and any customized code. The editor
default module script is divided among three major areas:
1.

Wizard-Added variables and Custom Level variables

2.

Wizard-Added Variable Initialization and Custom Method Calls

3.

Destroy Custom Code


Note Each of these areas determine variables placement and scripts to author code. Foreign-key views
and other variables are added automatically.

4. Examine SECTION 3:
Any area that begins with '// (VB.net) or // #) indicates comments. These sections display in green. They guide
custom code entry and document what the next routine is, which is helpful for other developers.
5. Examine SECTION 4:
The Sub InitializationCustomCode() indicates the beginning of code and methods for a specific routine.
6. Examine SECTION 5:

Epicor Software

Customization Overview | 17
The Sub DestroyCustomCode section is the Epicor application's way to clean up and refresh for the next routine.
All sub-routines initialize and then destroy (refresh) in preparation for the next routine or event.

Use the Test Code Feature


The Script Editor is available as a sheet inside the Customization Tools Dialog box. It divides the screen into several
areas. You may want to maximize the window so you have a large space to work. Notice that import statements have
already been created.
1. From the Tools menu, select Test Code.
Tip Use the compiler to test all codes entered through the Script Editor. It allows you to quickly check for
syntax errors and other problems in the code. Most code can compile on the spot, but some complex code
may require you to exit the form.

2. At the bottom of the Script Editor, in the Output pane, view the test results.
You may need to maximize the window to view the results.
In this example, no custom code is entered, so the compile displays Custom Code Compiled Successfully.
3. Close the Customization Tools Dialog window.
4. Exit Sales Order Entry.

Epicor 9 | 9.05.600

18 | Advanced Embedded Customization Course

The Customization Tool Set


The customization tool set consists primarily of the Customization Tools Dialog window. This is the main control
center on the user interface where you can create embedded customizations. This course is primarily concerned with
the Tools menu options of the Customization Tools Dialog window. The completion of the scenarios throughout the
course involves property modifications, use of each of the application wizards, as well as extensive scripting in the
Script Editor.
The Tools menu contains the following options:
ToolBox - This provides access to text boxes, labels, grids, and additions to the User Interface which are bound to
Data Values. Although this course uses a few of the options available in the ToolBox, it does not go into detail. For
more information on the Customization Toolbox, refer to the Embedded Customization course.
Assembly Reference Manager - An assembly is sometimes referred to as a package. These are .dll files that
contain all the objects and methods associated with a specific form. The Assembly Reference Manager provides an
easy way to work with existing assemblies.
Object Explorer - The Object Explorer allows you to access information about business objects. It includes UI
Objects, Data Objects, and Adapters.
Script Editor - The Script Editor displays all the code behind a specific field. As you create events or add objects to
a form, the code displays in the Script Editor.
Options menu - This provides options for using grids.
Custom XML Editor - As you use wizards, create controls, and modify control properties, the customization tools
automatically create the .xml code that runs the customization. All layers of this code display within the XML View
sheet and you can modify them within the Custom XML Editor.
Data Tools - You can use the Data Tools menu to design Foreign Key Views. It is a powerful tool that allows you
to link related tables together so they display the information you need.
Wizards - A series of wizards are available to guide you through creating your customizations.

ToolBox
Use the ToolBox to create custom controls on all sheets. When you select the ToolBox option from the Tools menu,
it displays on top of your current form. Click the buttons on the ToolBox to create custom controls on the form such
as text boxes, grids, check boxes, and so on.
The following toolbox elements are used in this course:
EpiLabel - This is the label associated with the grid.
EpiTextBox - This is the element that captures and stores string values.
EpiButton - This works in tandem with the Form Event wizard to set up the event handled by the button.
EpiUltraCombo - This is field that populates through hard-coded values or through values specified in a table.
EpiGroupBox - This is the visual element you can use to group screen elements.
EpiDateTimeEditor - This allows you to capture and store date/time values.
EpiPicture Box - This allows you to display images.

Epicor Software

The Customization Tool Set | 19


Each item in the ToolBox represents a specific control you can add to the interface. Each of these controls has its own
set of properties and methods. You can use them to create sub procedures within the Script Editor to assign unique
tasks to the controls that depend on user input or the occurrence of some event.

Epicor 9 | 9.05.600

20 | Advanced Embedded Customization Course

Workshop - Add the PictureBox Control


In the following scenario, inventory control requests that pictures of the parts be included in part master records when
possible.
To accomplish this request, use the Form Event Wizard to modify the Part Maintenance UI screen. The wizard generates
triggers that indicate when the picture displays and creates custom code that tells the Epicor application how to find
the picture and how to determine which picture to use.
This workshop demonstrates how to add a new picture box to the Part Master for a specific part.
Important This workshop assumes the Developer Mode is active and you are logged in with appropriate
permissions to generate customizations.

Create a PictureBox
Navigate to Part Maintenance.
Menu Path: Sales Management > Order Management > Setup > Part
1. In the Select Customization window, select the Base Only check box.
2. In the Default Customization Programming Language pane, select Visual Basic and click OK.
Note It is important to declare the programming language you want to use for the customization before
you make any changes to the form. This example uses the VB.Net programming language.
Part Maintenance displays.
3. From the Tools menu, select Customization.
The Customization Tools Dialog window displays.
4. If the Clear Confirmation message displays, click Yes.
This clears the screen of any data in preparation for customization.
5. Navigate to the Script Editor sheet.
6. Verify the VB (Visual Basic) option is selected.
7. From the Tools menu, select ToolBox.
8. In the Toolbox window, click EpiGroupBox.
9. Click inside the form, to the right of the Part field.
The Select Layer Type window displays.
10. In the Select Layer Type window, select Customization and click OK.
11. Drag the epiGroupBoxC1 down so that it fills the empty area to the right of the Part, Description, Type, and
UOM Class fields.
12. In the Customization Tools Dialog window, select the Properties sheet.
13. In the Text property, delete the content and enter Part Picture.

Epicor Software

The Customization Tool Set | 21


14. In the ToolBox window, click the EpiPictureBox.
15. Create a picture box inside the Part Picture group box.
16. In the Customization Tools Dialog window, in the Properties sheet, change the Name property to
picPartAttachment.
The Epicor application generates the Name property automatically when you create the new element. It uses the
first three characters of EPI. In this case, the new name is epiPictureBoxC1. You can only change this name property
at the time you create the field.
Once you insert the picture box, you can use handlers to execute the code.

Set Up the Handler for the PictureBox


This example uses two handlers to ensure the code executes based on a variety of events. Specifically, the
AfterRowChange and ListChanged event handlers trigger the picture box to display for a part.
1. Navigate to the Wizards > Form Event Wizard sheet.
2. In the Select Event Type field, select ListChanged.
3. In the Views field, select AutoAttachPart.
4. Click the blue right arrow button to add an event.
The new event moves to the event listing.
5. In the Select Event Type field, select AfterRowChange to add another event.
6. In the Views field, select AutoAttachPart.
7. Click the blue right arrow button to add the event.
The new event moves to the event listing.
8. Click the Update All Event Code button.
This signals the Epicor application to write the new event handler code into the Script Editor.
9. On the Standard toolbar, click Save.
The Customization Save Dialog displays.
10. In the Name field, enter XXXPicBox (where XXX are your initials).
Note Spaces are not allowed when you generate a customization name.

11. In the Description field, enter XXX Part with Picture Box (where XXX are your initials).
Note Spaces are allowed when you enter a value in the description field.

12. Click Save.


The Customization Comment window displays.

Epicor 9 | 9.05.600

22 | Advanced Embedded Customization Course


Tip Good practice is to enter notes that pertain to this customization for other users.

13. In the Add/Edit Comments box, enter Add a picture box and click OK.
The Epicor application automatically records your user name and date of the comment.
Now that handlers are established, enter custom code into the Script Editor to define the picture box file.

Author a Routine
1. Navigate to the Script Editor sheet.
Maximize the Customization Tools Dialog window.
2. Enter the first code just below '// Add Custom Module Level Variables Here ** and before the Sub
InitializeCustomCode() entry:
Dim mFileName As String
This code identifies the filename as a string.
3. Enter the following code after the Sub InitializeCustomCode() entry but before the comments:
mFileName = String.Empty
4. Enter the following code after the Sub DestroyCustomCode () area of the Script Editor and directly below the
End Sub statement.
Private Sub SetPictureBoxIconFromAttachMent()
Dim edvPartAttach As EpiDataView = CType(oTrans.EpiDataViews("AutoAttachPart") ,
EpiDataView)
If (Not(edvPartAttach Is Nothing) And (edvPartAttach.dataView.Count > 0)) Then
Dim fileName As String =edvPartAttach.dataView(0)("FileName")
If (mFileName <> mfileName) Then
mFileName = mFileName
picPartAttachment.Image = System.Drawing.Image.FromFile(mfileName)
Else
mFileName = String.Empty
picPartAttachment.Image = Nothing
End If
End Sub
Tip Make sure to enter the initial Dim statement as well as the If - Then clause into one row to avoid
syntax errors.

5. Immediately below this area, look for the event handlers added in the Form Event Wizard that begin with Private
Sub AutoAttachPart_AfterRowChange.
Just below the 'Add Event Handler Code ' line, enter:
SetPictureBoxIconFromAttachMent()
For each event handler, you need to add a method call to reference the routine you have just authored.

Epicor Software

The Customization Tool Set | 23


6. Immediately below this piece of code, look for Private Sub AutoAttachPart_DataView_ListChanged
entry. Just below the 'Add Event Handler Code ' line, enter:
SetPictureBoxIconFromAttachMent()
7. On the Standard toolbar, click Save.
8. In the Customization Comment window, click OK.
9. In the Customization Tools Dialog window, from the Tools menu, select Test Code.
A message displays in the lower portion of the screen that indicates the status of the compiled code. Review each
line to correct the compilation error, if necessary.
10. If the ** Custom Code Compiled Successfully ** message displays, click Save.
11. In the Customization Comments window, click OK.
12. Close the Customization Tools Dialog window and exit Part Maintenance.
The final step to this customization is to add an image that displays on the Part Maintenance UI screen.

Add the Image and Test the Part


On the Standard toolbar, click the Developer Mode icon to turn it off.
To populate the Part Maintenance screen with the image, enter the image as an attachment to the specific part record.
This task assumes you are working with the embedded version of this course, launched from the Epicor application.
Before you start, click the Casting image link at the bottom and notice the picture displays. Right-click the picture,
select Save Picture As, and save it to your Desktop.
If you are working with the .pdf version of this course, search for and use any picture in your local machine, for example,
C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures.
Navigate to Part Maintenance.
Menu Path: Sales Management > Order Management > Setup > Part
1. Click the Part button and Search for and select CS-87-4578.
2. From the Actions menu, select Attachments.
You can also click the Attachments icon on the toolbar to add attachments.
3. At the bottom of the Attachments screen, click New.
You may need to maximize the Part Maintenance screen to see the button.
4. In the File name field, click Browse to search for a picture.
Locate the picture you saved on your Desktop or search for any file on your local machine.
5. In the Client Source File window, locate the picture you saved on your Desktop or search for any file on your
local machine and click Open.
6. In the Attachment Management window, click OK.
7. On the Standard toolbar, click Save.

Epicor 9 | 9.05.600

24 | Advanced Embedded Customization Course


8. Exit Part Maintenance and return to the Main menu.
9. From the Options menu, select Change User ID and log back in.
Use the same ID and password: manager/manager.
10. On the Standard toolbar, click the Developer Mode icon to turn it on.
11. Reopen Part Maintenance.
12. In the Select Customization window, select the XXXPicBox (where XXX are your initials) customization and
click OK.
13. Browse for and select part CS-87-4578.
The picture you selected displays next to the part number.
14. Exit Part Maintenance.

Assembly Reference Manager


The Assembly Reference Manager displays a list of all the native assemblies you can use within the Epicor application.
Use the tree view to find and select an assembly; this displays the main information of the assembly. You can then use
this program to add custom code to the selected assembly.
The Assembly Reference Manager allows you to quickly locate and add custom assembly references to a customized
form.
Customization must often call methods external to the form set in which the customization is written to bring in
necessary data. Use assembly references when calling an adapter from another table in the application.
Key points are listed below:
An Assembly is a piece of code that joins UI Objects, Data Objects, and Adapters. Sometimes called packages,
assemblies are .dll files that group all the objects together to create a specific form.
An Adapter locates specific information and connects a UI object with a data object. Adapters use an assembly to
pull in the data they require.
Example A developer may need to access data only contained in the Customer master record and add that
as a custom text field in the Sales Order > Ship To sheet. To do this, the Customer Adapter is called within
Shipment Entry and the assembly references for the customer must be added for the adapter to work properly
(for example, Epicor.Mfg.AD.Customer.dll, Epicor.Mfg.BO.Customer.dll, and Epicor.Mfg.IF.ICustomer.dll).
You can add assembly references at any point during the customization process, although you must add them at the
same time you call the adapters to ensure correct script compilation. If you do not add references to a script that
contains one or more adapters, the script test throws an error that indicates the methods are not defined.
Below are the four assembly types:
BO - This assembly type displays the business object file required for the adapter.
IF - This assembly type displays the interface framework file required to display the fields and data the business
object generates.
AD - This assembly type displays the adapter code object that connects the business object to the interface framework
file.

Epicor Software

The Customization Tool Set | 25


UI - This assembly type calls a specific user interface object, such as a sales order form required by the business
object.
As a general rule, use the AD, BO, and UI assemblies at the same time for every adapter.
Business Logic Assembly References Wizard
You can use this wizard to add assembly references required for the custom code to use a selected adapter. The wizard
first looks for the specific adapter and then automatically brings in the correct assemblies for that object.

Epicor 9 | 9.05.600

26 | Advanced Embedded Customization Course

Workshop - Create Assembly References


Use the Assembly Reference Manager to add custom assemblies.
Important The workshop assumes the Developer Mode is active and the user is logged in with appropriate
permissions to generate customizations.
You can use the Assembly Reference Manager to manually add an Assembly Reference or you can run the Business
Logic Assembly Reference wizard.
This workshop demonstrates how to use Customer Shipment Entry to manually add custom assemblies.
Navigate to Customer Shipment Entry.
Menu Path: Material Management > Shipping / Receiving > General Operations > Customer Shipment Entry
1. In the Select Customization window, select the Base Only check box.
2. In the Default Customization Programming Language pane, select C# and click OK.
Customer Shipment Entry displays.
3. From the Tools menu, select Customization.
The Customization Tools Dialog window displays.
4. In the Customization Tools Dialog window, from the Tools menu, select Assembly Reference Manager.
The Custom Assembly Reference Manager window displays.
5. Click the Add Custom Reference button.
The Add Assembly Reference window displays the content of the client folder.
6. In the File name field, enter *customer.* and click Open.
7. From the file listing, double-click Epicor.Mfg.AD.Customer.dll.
8. Repeat steps 5 - 7 to add the following assemblies:
Epicor.Mfg.BO.Customer.dll
Epicor.Mfg.IF.ICustomer.dll
9. In the Custom Assembly Reference Manager window, click OK.
Remain in the Customization Tools Dialog window.

Epicor Software

The Customization Tool Set | 27

Workshop - Automatically Generate the Assembly Reference


You can use the Business Logic Assembly References Wizard within any customization. It groups appropriate
assemblies together based on the selected adapter and writes the code to the Script Editor.
You can launch this wizard multiple times in a customization, if necessary. In this workshop, use the wizard to add the
same custom assemblies.
1. In the Customization Tools Dialog window, from the Tools menu, select Wizards > Customization Wizards.
The Customization Code Wizard Dialog window displays.
2. In the Customization Code Wizard Dialog window, select Reference Adapter/BL Assemblies and click
Launch Wizard.
3. In the Step 1 of 1 pane, click the Get Adapters button.
All the adapters available within the application populate in the list.
4. From the adapter listing, search for and select the CustomerAdapter line.
There are adapters for every business object in the application. Adapters are used to retrieve data but require a
reference to an assembly to operate.
Three assemblies (BO, IF, and AD) populate in the window for the Customer Adapter.
5. Click Finish and click Close to close the Customization Code Wizard Dialog window.
You can use the Assembly Reference Manager to view the three assemblies.
6. From the Tools menu, select Assembly Reference Manager.
The Custom Assembly Reference Manager window displays.
7. Expand the Custom Assemblies node to view the added assemblies.
Under the Custom Assemblies node, all added assemblies display. Two other assembly types display in this
Custom Assembly Reference Manager:
System Assemblies - These are required by the Microsoft backbone.
Native Assemblies - These are required by the Epicor application.
8. In the Custom Assembly Reference Manager window, click OK.
9. Close the Customization Tools Dialog window.
10. In the Save Confirmation window, click No.
11. Exit Customer Shipment Entry.

Epicor 9 | 9.05.600

28 | Advanced Embedded Customization Course

Custom Object Explorer


Use the Custom Object Explorer to browse for and select a specific code object(s) you can use in the custom code.
Business Objects provide abstracts of the programming structures that run the Epicor application. Business Objects
often encapsulate all the data, the specific business behavior, and workflows associated with the form or module it
represents. Business Objects do not necessarily need to represent objects in an actual business, although they often
do. They can represent any object related to the domain for which a developer is creating business logic. The term is
used to distinguish between the objects that relate to the domain and all the other object types.
The Custom Object Explorer displays the Business Objects in three categories:
UI Objects - UI Objects contain the code that displays the program interface on a monitor.
Data Objects - Data Objects contain the code that interacts with a database. It houses the methods used to enter,
view, and calculate data for a specific function within the application.
Adapters - Adapters are code objects that connect the UI object with a data object. This file makes calls that either
retrieve data from or send data to the data object.
Code snippets in the Object Explorer assist in writing VB.NET subroutines necessary to complete customization projects.
In general, two types of code samples display. One is the VB.NET code and the second is provided to demonstrate
another manner to access the same data.

Epicor Software

The Customization Tool Set | 29

Workshop - Review the Custom Object Explorer


In this workshop, use the Custom Object Explorer to locate the Job Entry screen properties and review the following:
UI Objects - This contains the code that displays program interface components on the screen. It houses the methods
used to display various programs. An example of an UI Object is a check box.
As you select an object from the tree view on the left, its details display on the right side of the screen. Following
are the details that display:
Return Type - This field displays the data types the method returns, for example, System.Boolean.
Property Type - This field displays the data type of the selected property, for example, System.string.
Parameters - This field displays the object's main attributes that are passed into the method, for example,
System.Object.
VB.Net Example - This field displays code snippets that can be used for the selected UI Object, Property, or
method. Two code styles can display for a given object.
Data Objects - This represent the data captured from the Epicor application tables of a specific Epicor Object.
Adapters - These are the bridges between datasets and datasources for retrieving information.

Access the Custom Object Explorer


Important The workshop assumes the Developer Mode is active and you are logged in with appropriate
permissions to generate customizations.
Navigate to Job Entry.
Menu Path: Production Management > Job Management > General Operations > Job Entry
1. In the Select Customization window, select the Base Only check box.
2. In the Default Customization Programming Language pane, select Visual Basic and click OK.
Job Entry displays.
3. From the Tools menu, select Customization.
The Customization Tools Dialog window displays.
4. From the Tools menu, select Object Explorer.
The Custom Object Explorer displays the UI Objects sheet specific to the Job Entry form.

Review EpiTransaction Objects


One of the most frequently used UI objects is the EpiTransaction object.
EpiTransaction Object (oTrans) is the layer between the UI and the adapter that binds the data to the UI and provides
the application data specific behavior.
1. Expand the Transaction > Properties node.
2. From the list, select EpiDataViews.
This is a hash table (transformation table) of all the EpiDataViews in the Transaction object. An EpiDataView
displays data from a specific table or form.

Epicor 9 | 9.05.600

30 | Advanced Embedded Customization Course


3. Under the Transaction node, expand the Methods node.
4. From the list, select Update ().
The oTrans.Update() method updates an existing piece of data.
5. From the list, select any method that begins with GetNew...().
These methods pull new records into a form.
6. Review other methods and properties as necessary.

Review Session Objects


While the UI object has many properties and methods, one of the most important is the Session Object that contains
several useful properties including the current plant, or company.
1. While in the UI Objects sheet, expand the Session > Properties node.
Session items are usually read-only.
2. From the list, select the User ID object and note the VB.Net example.
Example When writting a script, you can use the following conditional statement that begin as follows:
If (JobEntryForm.Session.UserID = "Jane Doe") Then
Or, you can use an If-Then-Else statement that calls out several user IDs. When you use multiple IF
statements, the final choice must be followed by End IF.

3. Select the PlantID object and view the corresponding code samples in the VB.Net example pane that demonstrate
how to access each property. The two examples on this screen provide code choices for the Get Property and
Set Property methods.

Review the ICustomScriptManager Object


Use the ICustomScriptManager to access global variables from the script. It serves as a communicator between the
custom assembly and the main client library. Review some useful methods below.
1. In the UI Objects sheet, expand the ICustomScriptManager > Methods node.
2. From the list, select the GetNativeControlReference method.
Use this method to retrieve a reference to the base control on the form. This method requires a string parameter
- controlGUID, which is the unique identifier for the specific control. The following line of code demonstrates the
general coding convention for use:
Dim ctrl As Control =
csm.GetNativeControlReference(5483cdef-3049-4705-b597-28ae93bc7fdf)
The example below shows use of the method when casting to a specific control type:
Dim eucSales As EpiUltraCombo =
CType(csm.GetNativeControlReference(5483cdef-3049-4705-b597-28ae93bc7fdf),
EpiUltraCombo
3. From the list, select the AddForeignKeyView method.

Epicor Software

The Customization Tool Set | 31


Use this method to add an updatable ForeignKeyView to the EpiTransaction object. Once this method is called,
the added ForeignKey is available for control binding. This method works in conjunction with business logic
adapters. Use of this method requires the following parameters:
ViewName(string) - This is the name of the Foreign Key View and must be unique.
dsData(DataSet) - This is an empty DataSet of the Foreign Key Views Type.
TableName (String) - This represents the name of the table that corresponds with the view in the DataSet.
The following lines of code demonstrate the use of this method:
'// Add Adapters Table to List of Views
'// This allows you to bind controls to the custom child view
Dim dsData As DataSet = CType(ud01Adapter.UD01Data, DataSet)
Dim fkvUD01 As ForeignKeyDataView = csm.AddForeignKeyView(MyUD01View, dsData,
UD01)
4. From the list, select the NotifyForeignKeyView method.
Use this method to update a ForeignKeyView added by the AddForeignKeyView() method. This method notifies
controls bound to the Foreign Key View that the data has changed. This method is almost always used in conjunction
with business logic adapters. Use of this method requires the same parameters as the AddForeignKeyView method.
The following lines of code demonstrate the use of this method:
'// notify with updated data
csm.NotifyForeignKeyView("UD01", CType(ud06Adapter.UD01Data, DataSet), "UD01")

Review EpiDataView Objects


The EpiDataView Object encapsulates a DataView of a particular DataTable that corresponds to a table in your
database. A direct correlation usually exists between a Database table and an EpiDataView. To investigate the specific
EpiDataViews available for a given UI application, see the Object Explorer tool's Data Objects sheet.
Use the Custom Object Explorer > Data Objects sheet to investigate the specific EpiDataViews available for a given UI
application.
1. In the Custom Object Explorer window, navigate to the Data Objects sheet.
2. From the list, expand the EpiDataViews > AutoAttachJobAsmblAttchAssembly > dataView node.
3. Select the AssemblySeq object.
4. The first row displays a reference to the selected EpiDataView object:
Dim [edvVarName] As EpiDataView =
CType(oTrans.EpiDataViews("AutoAttachJobAsmblAttchAssembly"), EpiDataView)
5. The second row displays how to access or set a value in the EpiDataView:
Dim [VarName] As Int32 = [edvVarName].dataView([edvVarName].Row)("AssemblySeq")
6. From the list, expand the JobHead > dataView node.
7. Select the TravelerReadyToPrint object.
Note the information on the specific field and data type. This field is a Boolean value that is either true or false.
It relates to the Mass Print check box that indicates its selection on the Job Entry form.
8. Select the CreatedBy field and view the Extended Props section.

Epicor 9 | 9.05.600

32 | Advanced Embedded Customization Course


9. Select the DueDate field and in the code box, review the code sample.
Tip You can copy these lines into the Script Editor for faster coding.

It is necessary to call out the variables indicated in the brackets. In the first line of code, a variable name must be
supplied to hold the new EpiDataView in code. Think of the EpiDataView as the entire table view for a customer.
The second line of code helps drill further down to field-level data by establishing a second variable based on the
value of the field in the EpiDataView. Bracketed text requires the substitution of a variable for the EpiDataView
value associated with the Due Date field for the job.
In general, the naming convention for EpiDataView variables is edvXXX.
Code snippets in the Object Explorer assist in writing the VB.NET subroutines necessary to complete customization
projects.
Below is an example of the InitializeCustomCodeI() method.
You can use this method to extend the object properties. The following code extends the JobNum field properties
inside the JobHead EpiDataView.
The VB.NET code is as follows:
Private Sub SetExtendedProps()
// Get EpiDataView reference
Dim edv As EpiDataView = CType(oTrans.EpiDataViews("JobHead"), EpiDataView)
If edv.dataView.Table.Columns.Contains("JobNum") Then
edv.dataView.Table.Columns("JobNum").ExtendedProperties("ReadOnly") = True
edv.dataView.Table.Columns("JobNum").ExtendedProperties("Enabled") = False
// or to make invisible
edv.dataView.Table.Columns("JobNum").ExtendedProperties("IsHidden") = False
End if
End Sub
The C# code is as follows:
private static void SetExtendedProps()
{
// Get EpiDataView reference
Dim edv As EpiDataView = CType(oTrans.EpiDataViews("JobHead"), EpiDataView)
if (edv.dataView.Table.Columns.Contains("JobNum"))
{
edv.dataView.Table.Columns["JobNum"].ExtendedProperties["ReadOnly"] = true
edv.dataView.Table.Columns["JobNum"].ExtendedProperties["Enabled"] = false
// or to make invisible...
//edv.dataView.Table.Columns["JobNum"].ExtendedProperties["IsHidden"] = false
}
}
Note The reference to make invisible in the above code demonstrates the manual way to hide a field.
There is also an Extended Properties wizard available to manipulate these properties (discussed later in the
course).

Epicor Software

The Customization Tool Set | 33

Review Adapters
Data adapters are bridges between datasets and datasources. Without an adapter, a dataset cannot access any kind
of data source.
The data adapter takes care of all connection details for the dataset, populates it with data, and updates the data
source. The methods on the adapters allow you to view the data within the dataset in a variety of ways and also provide
methods for the manipulation of the data. This second line of code helps drill further down to field-level data by
establishing a second variable based on the value of the field in the EpiDataView. Bracketed text requires the substitution
of a variable.
1. In the Custom Object Explorer window, navigate to the Adapters sheet.
2. Click the Get Adapters button.
All adapters are brought in at one time the first time you select this button.
3. Expand the Adapters node.
4. Select the PartAdapter adapter.
The adapter must know what assemblies (or .dll programs) are required to find its data. These display in the
Assembly References pane.
5. Expand the PartAdapter > Classes > PartAdapter > Methods node.
The method defines how the search locates the unique value for retrieval.
6. Select the GetByID method.
The Return Type of the method, Parameters (if any), and a VB.Net Example that demonstrates how you can
use it in a script displays.
In this example, the return type is a Boolean value that takes the parameter that represents the partNum value.
The GetByID method in this case assists in writing a script where you must validate data based on the existence
of a specific part number.
Example To call a specific field from the Part master file in the Engineering Workbench and update the
data in that field through the workbench, use the GetByID to validate the part number necessary before
you access the field data to modify.

7. Review the VB.NET Example.


The code examples contain additional import statements necessary to use the adapter in the green text. The first
line defines the adapter to use and how to connect to the business object (BO). The next line identifies how to
find the information (GetByID). The final line refreshes the code in preparation for the next command.
8. Close the Custom Object Explorer and the Customization Tools Dialog window.
9. Exit Job Entry.

Epicor 9 | 9.05.600

34 | Advanced Embedded Customization Course

Options Menu
The Tools > Options sub-menu contains an option to determine if the Customization Tools Dialog window is to
remain on top when you customize a form and an option to specify grid settings.
These options determine how the Customization Tools Dialog box is used during the current session. Some key grid
options can also be defined.
The following is a brief explanation of the choices:
Top Most - The dialog box, by default, displays on top of the form. You can clear this check box to display it behind
the form.
Grid Settings - Use the Grid Settings option to specify the grid characteristics used in Customization mode. Grid
settings include activating the Snap To Grid functionality and determining the grid size.
GridSize: Use the Grid Settings option to specify the grid characteristics used in Customization mode.
Snap To Grid: Select this option to help position shapes when you are creating customizations on a grid. When
this option is selected, the shapes pull, or snap, towards the grid dots.

Custom XML Editor


The Customization Tools Dialog > Tools > Custom XML Editor window displays the XML code of your customization.
Use the sheets in this troubleshooting tool to correct any issues that occur within the customization.
When open, all the layers of the XML behind the customized form display in a true XML layout. The Custom XML Editor
displays three sheets:
XML View - Use this sheet to display a read-only view of the XML code. It allows you to view the entire XML code
for the current form.
Custom Controls - Use this sheet to edit the various controls used on the current customization. Both native and
custom controls display on this sheet.
Control is the term given to any element on the screen. Examples of controls are text boxes, images, group boxes,
fields, and labels. Each control is listed as a separate row on this sheet.
Custom Properties - Use this sheet to edit the various properties of the controls set up for the current customization.
Both native and custom control properties display on this sheet.
A property defines a control. It indicates the control's current state or position within the form. It also defines the
value used within the control.

Data Tools
Use Customization Tools Dialog > Tools > Data Tools to create and edit custom data views.
Use this functionality to link related tables together so they display the information you need.

Epicor Software

The Customization Tool Set | 35


The Foreign Key View sheet allows you to create foreign key views for any Query Result or Data View that has a
field that allows you to search by its record (GetByID) identifier. You can then create a view based on the value of the
field.
Almost an unlimited amount of table combinations is available. You can create one view and then link a sub-view to
that view, another sub-view to the sub-view, and so on. As long as you can establish a logical connection between the
Parent and Child columns, you can display data through any combination of views you need.
After you create a foreign key view, you can use the features on the Custom Column Like sheet to add the Like
property to a specific field. You can also customize how the data displays within the grid through Row Rules. You
can highlight a column, bold a column's text, make columns invisible, and so on.

Epicor 9 | 9.05.600

36 | Advanced Embedded Customization Course

Custom Code Wizards


Use Customization Tools Dialog > Tools > Wizards > Customization Wizards to generate custom code.
Following is a list of Custom Code Wizards:
Reference Adapter/BL Assemblies - This wizard adds the references required for the custom code to use a
selected adapter. The custom code can then correctly run this adapter.
Modify Extended Properties - This wizard assists in defining a specific property for a selected DataColumn, which
is a field within a selected table.
Simple Search - This wizard adds a search program and search results fields to your customization.
Add User Defined Table as Child - This wizard adds a selected user-defined table to your current customization.
You can also use this wizard to modify or remove the user-defined table link.
Business Logic Method Call - This wizard automatically generates a call to any public method within an adapter.
You can also use it to map the input parameters required for both the method and the adapter.

Epicor Software

Custom Code Wizards | 37

Workshop - Use the Business Logic Assembly Reference Wizard


The Reference Adapter/BL Assemblies wizard adds assembly references to the custom code assembly that are
necessary to call Business Logic Adapter methods.
Important The workshop assumes the Developer Mode is active and you are logged in with appropriate
permissions to generate customizations.
Navigate to ABC Code Maintenance.
Menu Path: Material Management > Inventory Management > Setup > ABC Code
1. In the Select Customization window, select the Base Only check box.
2. In the Default Customization Programming Language pane, select C# and click OK.
ABC Code Maintenance displays.
3. From the Tools menu, select Customization.
The Customization Tools Dialog window displays.
4. From the Tools menu, select Wizards > Customization Wizards.
The Customization Code Wizard Dialog window displays.
5. In the Customization Code Wizard Dialog window, select Reference Adapter/BL Assemblies and click
Launch Wizard to start the wizard.
The Business Logic Assembly References Wizard window displays.
6. In the Step 1 of 1 pane, click the Get Adapters button.
All available adapters display.
7. In the list, select the ABCCode Adapter.
Once you select the adapter, all three assemblies for that adapter display.
8. In the Business Logic Assembly References Wizard window, click Finish.
9. In the Customization Code Wizard Dialog window, click Close.
10. In the Customization Tools Dialog window, select Tools > Assembly Reference Manager.
The Custom Assembly Reference Manager window displays.
11. Expand the Custom Assemblies node.
The wizard automatically selects all three required assemblies (AD, BO, IF) and populates the Custom Assemblies
with the selection.
12. In the Custom Assembly Reference Manager window, click OK.
13. Close the Customization Tools Dialog window.
14. In the Save Confirmation window, click No.

Epicor 9 | 9.05.600

38 | Advanced Embedded Customization Course


15. Exit ABC Code Maintenance.

Epicor Software

Custom Code Wizards | 39

Workshop - Use the Extended Property Wizard


The Modify Extended Properties wizard generates custom code to set the extended properties on a data column.
Extended field properties include IsHidden, Visible, ReadOnly, Enabled, and format.
Important The workshop assumes the Developer Mode is active and you are logged in with appropriate
permissions to generate customizations.

Launch the Customization


Navigate to UOM Class Maintenance.
Menu Path: Material Management > Inventory Management > Setup > UOM Class
1. In the Select Customization window, select the Base Only check box.
2. In the Default Customization Programming Language pane, verify the C# option is selected and click OK.
The UOM Class Maintenance form displays.
3. From the Tools menu, select Customization.
The Customization Tools Dialog window displays.
4. In the Customization Tools Dialog window, from the Tools menu, select ToolBox.
The Toolbox window displays.
5. From the Toolbox, select EpiTextBox.
6. Click to the right of the System Default check box.
The Select Layer Type window displays.
7. In the Select Layer Type window, select Customization and click OK.
8. To the right of the System Default check box, draw the new text field.
9. Close the Toolbox.

Launch The Extended Property Wizard


1. Select the new epiTextBoxC1 and navigate to the Customization Tools Dialog > Properties sheet.
2. Locate the EpiBinding property, set your cursor in the field, and open the list.
3. Expand the UOMClass table and double-click the Company field.
The EpiBinding property displays UOMClass.Company.
4. In the Customization Tools Dialog window, from the Tools menu, select Wizards > Customization Wizards.
The Customization Code Wizard Dialog window displays.

Epicor 9 | 9.05.600

40 | Advanced Embedded Customization Course


5. Select the Modify Extended Properties wizard and click the Launch Wizard button.
The Extended Property Wizard window displays.
6. In the Extended Property Wizard window, in the DataView field, select UOMClass.
7. In the DataField field, select Company.
8. In the Extended Property field, select Enabled.
9. In the Value field, select True.
10. Click Finish and click Close.
11. Remain in the Customization Tools Dialog window.

Test the Custom Code


1. Navigate to the Script Editor sheet to see the below code written by the wizard:
private static void SetExtendedProperties()
2. On the Standard toolbar, click Save.
The Customization Save Dialog window displays.
3. In the Name field, enter XXXExtended (where XXX are your initials).
4. In the Description field, enter XXX Extended UOMClassID (where XXX are your initials) and click Save.
5. Leave the Customization Comment window blank and click OK.
6. Close the Customization Tools Dialog window and exit UOM Class Maintenance.
7. Reopen UOM Class Maintenance.
8. In the Select Customization window, select XXXExtended and click OK.
9. Select any entry for Class ID to test the new text box.
Notice the Company information populates.
10. Exit UOM Class Maintenance.

Epicor Software

Custom Code Wizards | 41

Workshop - Use the Add User Defined Table as Child Wizard


The Add User Defined Table as Child wizard generates code to view, add, edit and delete a UD table as a child
DataView to an existing DataView application.
Important The workshop assumes the Developer Mode is active and you are logged in with appropriate
permissions to generate customizations.

Launch the Customization


Navigate to ABC Code Maintenance.
Menu Path: Material Management > Inventory Management > Setup > ABC Code
1. In the Select Customization window, select the Base Only check box.
2. In the Default Customization Programming Language pane, verify the C# option is selected and click OK.
The ABC Code Maintenance form displays.
3. From the Tools menu, select Customization.
The Customization Tools Dialog window displays.
4. In the Customization Tools Dialog window, select Tools > Wizards > Customization Wizards.
The Customization Code Wizard Dialog window displays.
5. From the wizard listing, select Add User Defined Table as Child and click the Launch Wizard button to start
the wizard.
6. In the Step 1 of 2 section, in the DataViews field, select ABCCode.
7. In the UD Adapters field, select UD01Adapter and click Next.
8. In the Step 2 of 2 section, in the Fields field, select ABCCode.
9. In the UD Key Fields, select Key1 and click Add to accept and populate the mapping field.
10. Click Finish and click Close.
You can review the generated code in the Script Editor section.
11. On the Standard toolbar, click Save.
The Customization Save Dialog window displays.
12. In the Name field, enter XXXUDTable (where XXX are your initials).
13. In the Description field, enter XXX User Defined Table (where XXX are your initials) and click Save.
14. Leave the Customization Comment window blank and click OK.
15. Close the Customization Tools Dialog window and exit ABC Code Maintenance.

Epicor 9 | 9.05.600

42 | Advanced Embedded Customization Course

Test the User-Defined Wizard


1. Reopen ABC Code Maintenance.
2. In the Select Customization window, select the XXXUDTable (where XXX are your initials) customization and
click OK.
3. From the Tools menu, select Customization.
4. If the Clear Confirmation message displays, click Yes.
5. In the Customization Tools Dialog window, from the Tools menu, select ToolBox.
6. From the ToolBox, select EpiTextBox and drag out a new field somewhere on the ABC Code Maintenance form.
7. In the form, click to the right of the ABC Code field.
The epiTextBoxC1 displays on the form.
8. Close the Toolbox.
9. In the Customization Tools Dialog > Properties sheet, select the EpiBinding field.
You should see a listing for the UD01View table as a possible datasource. You can now use it to bind additional
data on the screen.
10. Close the Customization Tools Dialog window.
11. To the Save Confirmation message, click Yes.
12. Exit ABC Code Maintenance.

Epicor Software

Custom Code Wizards | 43

Workshop - Use the Business Logic Method Call Wizard


Use the Business Logic Method Call wizard to automatically generate a call to any public method on an adapter.
You can also map the input parameters required for the method and the adapter.
The following scenario generates an Engineering Change Order (ECO) group number based on the company that is a
two-digit year plus a sequential number. Following are the basic steps to accomplish this:
1.

Use the Business Logic Method Call Wizard to add the Company adapter as an assembly and define the method
to call.

2.

Create a private function that defines the creation of the new ECO number using the method.

3.

Create the EpiNotificationEvent to tell the Epicor application to create the ECO number when the form is called.
Important This workshop assumes Developer Mode is active and you are logged in with appropriate permissions
to generate customizations.

Use the Business Logic Method Call Wizard


Use a user-defined field on the Company table to create an ECO group number in the Engineering Workbench form.
Set the generated group number as the current year followed by a dash and a sequential number. For example, if the
current year is 2009 and the last number was 007, the next group ID is 09-008.
Navigate to the Engineering Workbench.
Menu Path: Production Management > Engineering > General Operations > Engineering Workbench
1. In the Select Customization window, select the Base Only check box.
2. In the Default Customization Programming Language pane, select Visual Basic and click OK.
The Engineering Workbench displays.
3. From the Tools menu, select Customization.
The Customization Tools Dialog window displays.
4. In the Customization Tools Dialog window, select Tools > Wizards > Customization Wizards.
The Customization Code Wizard Dialog window displays.
5. From the listing, select Business Logic Method Call and click Launch Wizard.
The Business Logic Method Call window displays.
6. Click the Get Adapters button.
7. From the resulting list, select CompanyAdapter and click Next.
A list of methods displays.
8. From the Select Adapter Method listing, select the GetByID method.
Notice the Return Type field returns a boolean data type and the Parameters field takes a string as a parameter.

Epicor 9 | 9.05.600

44 | Advanced Embedded Customization Course


9. Click Next to continue the wizard.
10. In the Parameters field, select company : System.String.
11. In the Map Parameters to variables section, select the Inside Method option.
In this case, the method (GetByID) requires a parameter. Some methods require more than one parameter and
some require none. The parameter can be supplied in two ways - passed into the custom method the wizard
creates or declared and initialized to the correct value inside the method the wizard creates.
If the parameter is to be set inside the wizard generated method, it can set to the value of a field in an EpiDataView
or to an arbitrary expression (for example, 5, Hello, oTrans.Session.UserID, and so on).
12. Select the Set to Value/Expression option.
13. In the Value field, enter oTrans.Session.CompanyID and click Add.
This value displays in the field below.
The session object contains useful information. If necessary, refer back to the Custom Object Explorer section
for more information. In this case, the session value is the company active at the time this code executes. This
code is being used as part of the ECO number.
14. Click Finish and click Close.
15. On the Standard toolbar, click Save.
The Customization Save Dialog displays.
16. In the Name field, enter XXXBLWiz (where XXX are your initials).
17. In the Description field, enter XXX Business Logic Wizard (where XXX are your initials) and click Save.
The Customization Comment window displays.
18. In the Add/Edit Comments pane, enter AutoGenerate ECO number and click OK.
19. Navigate to the Script Editor sheet to see that the wizard automatically adds a method called:
Private Sub CallCompanyAdapterGetByIDMethod()

Author a Routine
Now that the adapter is added, custom code is written to complete the definition of the GetECO() as String call.
Add a private function to tell the Epicor application what must be done. In this example, the code tells the application
how to create the new ECO group number.
1. Navigate to the Script Editor sheet.
2. Locate the Private Sub CallCompanyAdapterGetByIDMethod() section and change the existing code to:
Private Function GetNextECO() As String
3. Add the following code just below the Dim result As Boolean = adapterCompany.GetByID(company)
entry:
Dim nextECO As String = String.Empty
If (result) Then
nextECO = adapterCompany.CompanyData.Company.Rows(0)("Number02").ToString()

Epicor Software

Custom Code Wizards | 45


adapterCompany.CompanyData.Company.Rows(0).BeginEdit()
adapterCompany.CompanyData.Company.Rows(0)("Number02") += 1
adapterCompany.CompanyData.Company.Rows(0).EndEdit()
adapterCompany.Update()
End If
4. Just below the adapterCompany = Nothing entry, enter the following:
Return nextECO
End Function
5. Delete the End Sub line.
6. Click Save and enter comments if desired.
7. From the Tools menu, select Test Code.
The ** Custom Code Compiled Successfully ** message displays.
Address any compile errors if they arise.

Add an EpiNotificationEvent
Trigger an EpiNotificationEvent right after a dataView loads into an application. It signals that the data is ready to view
or edit.
The code below defines the next sequential number by calling the GetNextECO routine. The following code defines
the GroupID as a two digit year followed by a dash and the next sequential number.
1. In the Customization Tools Dialog window, navigate to the Wizards > Form Event Wizard sheet.
2. In the Select Event Type field, select EpiViewNotification.
3. In the Select View/Table (and Field) Views: field, select ECOGroup.
4. Click the blue right arrow to record the selection.
See the code that displays in the View / Edit Event Handling Code pane.
5. Click the Update Selected Event Code button.
The Epicor application generates the Form Event code and places it inside the Script Editor.
6. Navigate to the Script Editor sheet and locate the Private Sub edvECOGroup_EpiViewNotification
section in the code window.
7. Enter the following code after the If (args.Row > -1) Then code line:
view.dataView(Args.Row)("GroupID") =
Right(Year(view.dataView(args.Row)("CreatedDate")),2) & "-" & GetNextECO
view.dataView(args.Row)("ECO") = view.dataView(args.Row)("GroupID")
8. From the Tools menu, select Test Code.
The ** Custom Code Compiled Successfully ** message displays.

Epicor 9 | 9.05.600

46 | Advanced Embedded Customization Course


Address any compile errors if they arise.
9. On the Standard toolbar, click Save.
The Customization Comment window displays.
10. In the Customization Comment window, click OK.
11. Close the Customization Tools Dialog window and exit the Engineering Workbench.
12. Re-open the Engineering Workbench.
13. In the Select Customization window, select the XXXBLWiz customization and click OK.
14. On the Standard toolbar, click New.
Note the GroupID that automatically generates.
15. Enter a description of your choice and click Save.
16. Create one more entry to test the function and then exit the Engineering Workbench.
17. In the Save Confirmation window, select No.

Epicor Software

Code Examples | 47

Code Examples
This section includes several workshops that present custom coding examples using all the customization tools.
Following is a list of customization techniques discussed:
UI-Controls - Each item in the embedded customization toolbox represents a user interface control.
Modify a Sub Process - A sub-process is a routine called from a variety of UI applications. You can customize them
only by calling out the specific process. A new Sub-Process menu is then created and attached to the original process,
which is called using the new customization.

UI Controls and Form Events


UI Controls refer to elements on a specific UI application, such as Sales Order Entry. Users frequently wish to combine
any number of form event triggers and to add custom controls to the UI form.
You can further enhance many UI controls (such as EpiTextBoxes, EpiGrids, and such) to execute an event based on a
specific trigger.
Example The Price Lists button on the Part Maintenance screen opens a new screen to allow you to view
existing price lists. Another example is to add a button that opens a web page once you click it.
The following example demonstrates the wizard like tool that allows you to embed a specific dashboard in a sheet.

Epicor 9 | 9.05.600

48 | Advanced Embedded Customization Course

Workshop - Work with Embedded Dashboards


You can use the Embedded Dashboard Panel wizard to add a dashboard to a new sheet. This wizard allows you to
find and select the dashboard you want to place within your new sheet. You can also use this wizard to indicate if the
selected dashboard will publish (display) its data within another dashboard or subscribe (update) its data based on
another dashboard.
This example provides the steps to add a new sheet that displays the Part On Hand Status dashboard directly inside
the Part Maintenance UI application. You can test the new, embedded dashboard before you actually deploy it within
the Run Mode to ensure it accurately displays the records desired.
Any dashboard can be embedded into a specific program's interface though the Sheet Wizard; these include all the
dashboards delivered with the Epicor application, as well as any the user creates. Regardless of the dashboard you
select for inclusion into a sheet, the dashboard must have some data connection or relationship with the UI in which
it is to be embedded.
You can use the Data Dictionary Viewer to assist you in selecting the best columns for subscription when you embed
a dashboard or when you are uncertain in your decision.
Important The workshop assumes the Developer Mode is active and you are logged in with appropriate
permissions to generate customizations.

Add a New Sheet


Navigate to Part Maintenance.
Menu Path: Material Management > Inventory Management > Setup > Part
1. In the Select Customization window, select the Base Only check box.
2. In the Default Customization Programming Language pane, select C# and click OK.
Part Maintenance displays.
3. From the Tools menu, select Customization.
The Customization Tools Dialog window displays.
4. In the Customization Tools Dialog window, navigate to the Wizards > Sheet Wizard sheet.
5. Click the New Custom Sheet button.
6. From the Dockable Sheets listing, select mainPanel1.
The new sheet positions on the top level of the UI application.
Tip Select Docking Sheet if the new sheet can also have sheets attached to it.

7. In the Name, Text, and Tab Text fields, enter PartStatus.


8. Click the Add Dashboard button.
The three-part Embedded Dashboard Panel Wizard displays.
9. Verify the Dashboard Panel option is selected.
This causes the embedded dashboard to bring the dashboard definition directly from the dataset during run time.

Epicor Software

Code Examples | 49
Tip Use the AppBuilder Panel to cause the embedded dashboard to build the finished dashboard
assembly. This selection generally provides better performance as the dashboard is loaded after it is compiled.

10. Click the Dashboard ID button to search for and select the PartOnHandStatus dashboard.
11. Select both the Display Dashboard Tool Bar and Display Dashboard Status Bar check boxes.
These selections bring in the elements directly from the dashboard.
12. Click Next to proceed to Step two of the wizard.

Define the Publish and Subscribe Options of the Dashboard


A dashboard typically uses Publish and Subscribe functionality to display its properties. You can also use these features
in an embedded dashboard.
A dashboard can subscribe or publish to the data in the UI form based on the options defined in the Step 2 of 3 window.
1. From the option listing, select Publish data to the UI.
Select this option if the dashboard must display data pulled from another query.
Following is a brief description of the other choices:
Subscribe to UI data (auto Retrieve on publication) - Select this option to allow the dashboard to
automatically retrieve data when the customized program publishes the current value.
Subscribe to UI data (include Retrieve button) - Select this option if the dashboard should automatically
clear data when the customized program publishes the current value. A Retrieve button displays to allow you
to manually retrieve the data.
Neither Subscribe nor Publish - Use this option to have the dashboard display the data contained within
itself.
2. Click Next.
The Publish Data to the UI option requires dashboard columns for which the user interface must subscribe to
be defined.
3. From the Available Published Columns listing, select Part.Partnum.
4. Click the Add Published Column button.
5. Click Finish to return to the Customization Tools Dialog window.
Note that PartStatusOnHandStatus now displays within the Add Dashboard field.
6. Click the right blue arrow to move the PartStatus embedded dashboard into the Custom Sheets listing.
The dashboard does not embed until it displays under the Custom Sheets.
7. Click Save.
The Customization Save Dialog window displays.
8. In the Name field, enter XXXDashboard (where XXX are your initials).
9. In the Description field, enter XXX Embedded Dashboard (where XXX are your initials) and click Save.
The Customization Comment window displays.

Epicor 9 | 9.05.600

50 | Advanced Embedded Customization Course


10. Leave the Customization Comment window blank and click OK.
11. Close the Customization Tools Dialog window.
12. Return to Part Maintenance, and in the Part field, enter DSS-1000 and press Tab.
13. Navigate to the PartStatus sheet to display the Part On Hand Status dashboard.
14. Exit Part Maintenance.

Modify Infragistics Components


To modify aspects of the form menu, access the Infragistics control properties that form the intrinsic, structural
components of the user interface.
Application
The code that displays below demonstrates the method in which infragistics components that make up the UI structure
or frames can be modified. The code that displays is written for ABC Code Maintenance; the general principles can be
extrapolated to any UI application and you can insert them before the End Module statement at the end of the
automated Script Editor statements.
The Delete icon sometimes presents a potential pitfall for users due to its proximity to the Save icon. To ensure users
do not inadvertently press the Delete icon when they attempt to save a record, you can hide this icon from the form
toolbar.
Review the VB.net code below and note how the code uses a Try/Catch block. Try/Catch is one of the most useful ways
to deal with exceptions the UI components throw. The UltraToolbarManager is an instance of an Infragistics component.
These are not exposed in the system architecture and are not accessible through the Object Explorer. The code example
below is strictly for use with the sometimes troublesome Delete icon:
Private Sub AbcCodeForm_Load(ByVal sender As Object, ByVal args As EventArgs)
'Add Event Handler Code
try
If (baseToolbarsManager.Tools.Exists("DeleteTool")) Then
'// verify we have the "Standard Tools" toolbar
If (baseToolbarsManager.Toolbars.Exists("Standard Tools"))
baseToolbarsManager.Toolbars("Standard
Tools").Tools("DeleteTool").InstanceProps.Visible =
Infragistics.Win.DefaultableBoolean.False
baseToolbarsManager.Toolbars("FileMenu").Tools("DeleteTool").InstanceProps.Visible
=
Infragistics.Win.DefaultableBoolean.False
end if
end if
Catch Ex as Exception
ExceptionBox.Show(Ex)
End try

Epicor Software

Code Examples | 51
End Sub

Modifying Sub Processes


Use Sub Process Maintenance to create sub process menu IDs for programs you customized and wish to launch or
call from within other programs.
A sub process is a small program that is called to execute from an Action menu item or from within the UI itself. They
are called from a variety of UI applications.
Example Memo comments, attachments, and Customer Relationship Management (CRM) calls are all examples
of sub-processes called from the Action menu or the toolbar.
Using the embedded customization toolset on these sub-processes is a three step process:
Use the customization tools to access the sub-process and modify the UI.
Use Sub Process Maintenance to identify the menu ID for a custom program. The ID is linked to an assembly (.dll)
in order to execute the process from within other programs.
Use Process Calling Maintenance to launch, or activate, the sub-process program.
Some Action menu sub processes are not separate assemblies (.dlls) but execute at the same time the UI form executes.
The only way to customize this type of sub process is to also customize the main UI form it is linked to. For example,
the Job Entry UI includes the New Job selection from the New menu. The sub process (New Job) is customized by
launching it as part of Job Entry. A specific customization of the Job Entry UI must also be created with the same name
as the sub process. Therefore, when you deploy the customization to a menu item for the main form, the sub form's
customization is also applied. You then give a name to the customization of the Job Entry form.
Menu Path
Navigate to this program from the Main Menu:
System Management > Security Maintenance > Menu Maintenance
System Management > Utilities > Menu Maintenance
System Management > Utilities > Sub Process Maintenance
Important This program is not available
in the Epicor Web Access interface. You can launch this program

from an Epicor Smart Client (Windows ) interface.

Epicor 9 | 9.05.600

52 | Advanced Embedded Customization Course

Workshop - Modify Sub Processes


Sub processes are called from a variety of UI applications.
The basic steps required to use the embedded customization toolset on these sub processes include the following:
1.

Identify the sub process to be customized.

2.

Customize the specific sub process.

3.

Create a new sub process menu.

4.

Attach the menu to the process using the new customization.

The following workshop demonstrates how to customize the Memo Entry sub process when called from a customer
record.
Important The workshop assumes the Developer Mode is active and you are logged in with appropriate
permissions to generate customizations.

Identify the Sub Process


Navigate to Customer Maintenance.
Menu Path: Sales Management > Order Management > Setup > Customer
1. In the Select Customization window, select the Base Only check box.
2. In the Default Customization Programming Language pane, verify C# displays and click OK.
Customer Maintenance displays.
3. Verify the Customer > Detail sheet displays.
4. In the Customer field, enter Dalton and press Tab.
5. From the Actions menu, select Memo.
The Process Calling window displays the actual key for the process being called. Note the Key and Calling
Preferences inside the Process Calling screen.
6. To the message, click OK.
7. In the Select Customization window, select the Base Only check box.
8. In the Default Customization Programming Language section, verify C# displays and click OK.
The Memo Entry Detail form displays.

Customize the Memo Window


1. From the Tools menu, select Customization.
The Customization Tools Dialog window displays.
2. In the form, click the groupbox and extend it to allow space for an additional field.

Epicor Software

Code Examples | 53
3. In the Customization Tools Dialog window, select Tools > ToolBox.
4. In the Toolbox, select the EpiDateTimeEditor.
5. Click inside the groupbox, below the Memo Category field.
The Select Layer Type window displays.
6. In the Select Layer Type window, select Customization and click OK.
7. Draw the new field just below the Memo Category field.
8. Navigate to the Customization Tools Dialog > Properties sheet and select the EpiBinding field.
9. Open the list, expand Memo, and double-click Date01.
10. From the Toolbox, select the EpiLabel tool and create a label to the left of the EpiDateTimeEditor field.
11. Click the newly created epiLabelC1.
12. Navigate to the Customization Tools Dialog > Properties sheet and select the Text field.
13. In the Text field, delete the content and enter Create Date.
14. Click Save.
The Customization Save Dialog window displays.
15. In the Name field, enter XXXMemo (where XXX are your initials).
16. In the Description field, enter XXX Memo (where XXX are your initials) and click Save.
17. In the Customization Comment window, enter Added Create Date Field and click OK.
18. Close the ToolBox and the Customization Tools Dialog window.
19. Exit Memo Entry and Customer Maintenance and return to the Main menu.
The Memo Entry UI is now customized. The new sub process must be defined.

Create the Sub Process


On the Standard toolbar, click the Developer Mode icon to disable it.
Navigate to Sub Process Maintenance.
Menu Path: System Management > Utilities > Sub Process Maintenance
Important This program is not available
in the Epicor Web Access interface. You can launch this program

from an Epicor Smart Client (Windows ) interface.


1. Click New.
2. Enter the following information:
Field

Data

Menu ID

UDMemoXX (where XX are your initials)

Epicor 9 | 9.05.600

54 | Advanced Embedded Customization Course

Field

Data

Name

XXX Memo with Create Date (where XXX are your initials)

Security ID

SEC018

Order Sequence

100

Program Type

Non Menu Item

Program

Epicor.Mfg.UI.MemoEntry.dll

Tip If you receive the Duplicate Order Sequence for this parent menu ID message, use a different
Order Sequence number.

3. In the Customization field, select XXXMEMO (where XXX are your initials).
4. Click Save and exit Sub Process Maintenance.
5. From the Main menu, select Options > Change User ID.
This refreshes the session and makes the new menu item available.
6. Log back in to the Epicor application.
In the User name and Password fields, enter manager.

Create the Process Calling


Use Process Calling Maintenance to determine what applications or customizations are called when an application
is called anywhere in the Main menu (including action menus, context menus, and buttons).
Navigate to Process Calling Maintenance.
Menu Path: System Management > Utilities > Process Calling Maintenance
Important This program is not available
in the Epicor Web Access interface. You can launch this program

from an Epicor Smart Client (Windows ) interface.


1. Click New.
2. In the Called Process Reference field, enter Epicor.Mfg.UI.MemoEntry (without the .dll extension).
This is the same program identified in Sub Process Maintenance without the .dll extension.
3. Leave the Called From field blank.
If you leave this field blank, the customization form is used any time it is called from within the Epicor application.
Only enter information here if you want to limit the calling of this particular customization form.
4. In the MENU ID field, select UDMemoXX (where XX are your initials).
5. Click Save and exit Process Calling Maintenance.

Test the New Sub Process


From the Main menu, select Options > Change User ID.

Epicor Software

Code Examples | 55
In the User name and Password fields, enter manager.
Test the new sub-process.
Navigate to Customer Maintenance.
Menu Path: Sales Management > Order Management > Setup > Customer
1. In the Customer field, enter Addison and press Tab.
2. From the Actions menu, select Memo.
3. Verify the new customized version of Memo Entry includes the Create Date field.
4. Exit both Memo Entry and Customer Maintenance.

Delete the Sub Process


Navigate to Sub Process Maintenance.
Menu Path: System Management > Utilities > Sub Process Maintenance
Important This program is not available
in the Epicor Web Access interface. You can launch this program

from an Epicor Smart Client (Windows ) interface.


1. On the tree view, expand the Processes node.
2. On the tree view, select your customization XXX Memo with Create Date (where XXX are your initials).
3. On the Standard toolbar, click Delete.
4. To the "Delete this record?" message, click Yes.
The customization created in the previous workshop is now removed.
5. Click Save and exit Sub Process Maintenance.

Epicor 9 | 9.05.600

56 | Advanced Embedded Customization Course

Tracing Options
The Tracing Options Form window allows you to set up a tracing log that captures all the calls the user interface
makes to the server. When you activate this log, any business logic (BL) calls sent to the server are automatically
recorded within this log.
The tracing log tool has several uses. Web service developers can use this log to see what business logic calls are being
made when users launch a specific function, for example, the BL calls made when a user enters a new customer record.
Custom programmers can use this log to fine-tune their customized applications. Epicor Support may also ask you to
turn on this log to help them track issues.
To make this log easier to review, you can enter Mark Text to organize it; all calls that reference this mark text are
then grouped together. You have the option to display this log either as a text ( .txt) file or as an .xml file. Note that
a pre-built .xml style sheet is included with this functionality. It is recommended that you use the .xml file format, as
it organizes these calls in a readable format.
Note You can also turn the tracing log on and off within the mfgsys.exe.config file.

Epicor Software

Tracing Options | 57

Workshop - Create the Tracing Log


Use the Tracing Options to set up a tracing log that captures all public business object calls. This includes calls initiated
from the client, as well as calls from one object to another. When you activate this log, any public business calls sent
to the server are recorded in the log. You can use the tracing log to track business object calls so you can see how
successful operations are performed within the Epicor application. You can then map the business logic as needed to
a Service Connect workflow.
Important Due to the logic of creating and processing the tracing log, this workshop can only be performed
by one person on a shared database.

Configure and Start a Trace Log


1. In the application's Main menu window, from the Options menu, select Tracing Options.
The Tracing Options Form window displays.
2. In the Configuration Settings pane, select the Enable Trace Logging check box.
3. In the Dataset Options pane, select the Write Full DataSet check box.
Select this check box to record all call data in the tracing log.
4. In the Mark Text field, enter any specific text to organize the tracing log.
All the calls that reference this mark text are then grouped together.
5. Click Apply.
6. Exit the System Monitor to reduce the number of trace packets in the log.
To exit the System Monitor, right-click the System Monitor icon in the Notification Area (right side of the task bar)
and select Exit. You can restart the System Monitor using the following menu path:
Menu Path: System Management > Utilities > System Monitor
Important This program is not available in the Epicor Web Access interface. You can launch this program

from an Epicor Smart Client (Windows ) interface.

Create an XML Trace Report


Click the Create XML button to begin the trace log. All business object calls from this point forward are entered into
the log file shown in the Current Log File field. Click View to view the log file at any time. To clear the log, click Clear
Log.
You can save the trace file to an XML file. The application generates an XSL stylesheet so when you open the XML file,
it is formatted in a report layout.
1. In the Tracing Options Form window, click the Ellipsis (...) button next to the XML File field.
2. Browse to a location on your computer where you want the file created.
3. In the File name field, enter a File name.

Epicor 9 | 9.05.600

58 | Advanced Embedded Customization Course


4. Click Save.
5. Click the Create XML button.
To view the XML trace, go to the folder where the XML file was created and double-click the file.
Note If you send the XML file to someone else, include the TracePacket_Default.xsl file.

6. Remain in the Tracing Options Form window.

Disable Tracing
Disabling the Tracing functionality is important when it is not necessary to run. The Tracing Log can become
overwhelmingly large if it is always enabled.
1. In the Tracing Options Form window, clear the Enable Trace Logging check box.
2. Click the Apply button.
3. Click OK.
The Tracing Log is now disabled.

Epicor Software

Customization/Personalization Maintenance | 59

Customization/Personalization Maintenance
Customization/Personalization Maintenance is an important tool that allows you to manage all the customizations
and personalizations that exist within your Epicor application. Its primary feature is its verification functionality that
allows you to detect problems within any customization or personalization.
Menu Path: System Management > Utilities > Customization Maintenance
Important This program is not available in the Epicor Web Access interface. You can launch this program

from an Epicor Smart Client (Windows ) interface.


This maintenance program allows you to launch the tools you need to correct issues that occur.
Customization/Personalization Maintenance is especially useful when you upgrade the Epicor application to a new
version, as it can help you make customized and personalized programs compatible with the current version.
Use the Detail sheet to select, update, or delete a specific customization or personalization.
The Warnings sheet displays any elements (controls or properties) within the customized or personalized program
that do not validate. These elements display within the Warnings grid.
Use the Compile/Script Errors sheet to review any larger issues within the selected customization or personalization.
These are errors the verification process generated. Use this sheet to help discover what you need to do to resolve the
error.
Customization/Personalization Maintenance has additional functionality that allows you to import and/or export
your customizations and personalizations, allowing you to make these programs available throughout your organization.
This maintenance tool also allows you to delete any customization or personalization. Use this feature to either remove
custom program stages you no longer need or remove personalizations made by employees who are no longer with
your company.
System Administrators with Security Manager rights can use this program to modify fields and delete any
customizations and personalizations created by users. For System Administrators without Security Manager rights, this
program displays in a Read-Only format. For more information on security, review Application Help topic: Security
Overview.
Note You cannot access Customization/Personalization Maintenance from the Customization Tools Dialog
window. You must select it from the Main menu.
Customization/Personalization Maintenance allows you to:
Review the details on each customization or personalization, including the Product ID, Version, LastUpdated By,
Form Name, and Parent Layer.
Delete obsolete customization files.
Delete all personalizations associated with a specific user.
Select a customization as a Work in Progress. This prevents the customization from being used within the application
before it is ready.
Export a customization that you wish to use elsewhere.
Import a customization that you want to incorporate into your Epicor application. Any customization .xml file from
an outside source must be imported to the appropriate program in the application using this utility.
Test if your customizations and personalizations work properly. This verification tool can review all the custom fields
and code within a selected customization or personalization or a group of customizations and personalizations. It
then informs you whether the customization or personalization is valid.

Epicor 9 | 9.05.600

60 | Advanced Embedded Customization Course


Use Run Mode and Developer Mode Access to immediately launch a customization or personalization in both Run
Mode and Developer Mode within Customization/Personalization Maintenance. You can use these functions, for
example, to discover why a selected personalization or customization does not work properly.
Set a Verification Warning for users who attempt to launch a customized or personalized program that is not
compatible. An error message displays that prevents the user from launching the program. You can then use
Customization/Personalization Maintenance to upgrade the program.

Epicor Software

Customization/Personalization Maintenance | 61

Workshop - Use Customization/Personalization Maintenance


This workshop introduces you to the fundamental features of Customization/Personalization Maintenance.
Important You must have Security Manager rights to access this program.
The workshop should be performed in Run Mode.

Export a Customization
Navigate to Customization/Personalization Maintenance.
Menu Path: System Management > Utilities > Customization Maintenance
Important This program is not available
in the Epicor Web Access interface. You can launch this program

from an Epicor Smart Client (Windows ) interface.


1. Navigate to the Detail sheet and click Name.
2. Browse for and select the XXXBLWizard (where XXX are your initials) customization created earlier.
3. From the Actions menu, select Export Customization.
The Export Customization window displays.
4. In the New Name field, enter BLWizardXXX (no spaces and where XXX are your initials).
5. Click Export Filename and browse to your Desktop.
6. In the File name field, enter XXXExport (where XXX are your initials) and click Save.
The exported customization retains the New Name while the export file name is used to identify the new file.
7. In the Export Customization window, click Export.
The exported file is used for the remaining workshops.

Import a Customization File


1. On the Standard toolbar, click Clear to clear the Customization/Personalization Maintenance screen.
2. To the Clear This Form? message, click Yes.
3. From the Actions menu, select Import Customization.
4. Click the Import Filename button and browse for and select XXXExport (where XXX are your initials).
5. In the New Name field, enter MyBLWizardXXX (no spaces and where XXX are your initials).
6. Click OK.
The Customization Maintenance dialog window now indicates that the new customization was imported
successfully.

Epicor 9 | 9.05.600

62 | Advanced Embedded Customization Course


7. To the Customization Maintenance message, click OK.

Review and Verify the Imported Customization File


1. Review the information that displays on the Detail sheet.
Note Notice the Valid For and Status fields are currently blank.

2. From the Actions menu, select Verify Customization.


Note The Actions menu contains two features that allow you to verify code. Verify Customization simply
runs the code in the current customization file through a validation sequence in order to find any errors
and potential problems with controls referenced by the form. The Verify All option runs this validation
against all current customization files for all UI application programs. Verify All can be a long process and
should be reserved for times when the least amount of users are currently logged into the application.

3. Note the Valid For field populates with the current application version and the Status field displays Pass.
4. Navigate to the Compile/Script Errors sheet.
If any compile errors exist, they display in the Errors grid.
5. Navigate to the Warnings sheet.
The Warnings sheet displays errors (if they occur) that indicate a problem with the customization. The code must
compile before an accurate list of warnings displays.
6. In the tree view, verify your customization MyBLWizardXXX (where XXX are your initials) is selected.
7. On the Standard toolbar, click Delete.
8. To the Delete this record? message, click Yes.
9. Exit Customization/Personalization Maintenance.

Epicor Software

Conclusion | 63

Conclusion
Congratulations! You have completed the Advanced Embedded Customization course.
Please take a moment to let Epicor know how to serve you better by completing a course evaluation at
http://www.keysurvey.com/survey/191084/2e21/ or by clicking the Course Evaluation link below. Your feedback provides
the guidelines for the future direction of Epicor education.

Epicor 9 | 9.05.600

You might also like