100% found this document useful (1 vote)
366 views71 pages

Advanced Embedded Customization

Epicor Tools

Uploaded by

Jorge Vargas
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
100% found this document useful (1 vote)
366 views71 pages

Advanced Embedded Customization

Epicor Tools

Uploaded by

Jorge Vargas
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 71

Epicor ERP

Advanced Embedded
Customization Course
10.1
Disclaimer
This document is for informational purposes only and is subject to change without notice. This document and its
contents, including the viewpoints, dates and functional content expressed herein are believed to be accurate as of its
date of publication. However, Epicor Software Corporation makes no guarantee, representations or warranties with
regard to the enclosed information and specifically disclaims any applicable implied warranties, such as fitness for a
particular purpose, merchantability, satisfactory quality or reasonable skill and care. As each user of Epicor software is
likely to be unique in their requirements in the use of such software and their business processes, users of this document
are always advised to discuss the content of this document with their Epicor account manager. All information contained
herein is subject to change without notice and changes to this document since printing 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. Usage
of the solution(s) described in this document with other Epicor software or third party products may require the purchase
of licenses for such other products. Where any software is expressed to be compliant with local laws or requirements
in this document, such compliance is not a warranty and is based solely on Epicor's current understanding of such laws
and requirements. All laws and requirements are subject to varying interpretations as well as to change and accordingly
Epicor cannot guarantee that the software will be compliant and up to date with such changes. All statements of
platform and product compatibility in this document shall be considered individually in relation to the products referred
to in the relevant statement, i.e., where any Epicor software is stated to be compatible with one product and also
stated to be compatible with another product, it should not be interpreted that such Epicor software is compatible
with both of the products running at the same time on the same platform or environment. Additionally platform or
product compatibility may require the application of Epicor or third-party updates, patches and/or service packs and
Epicor has no responsibility for compatibility issues which may be caused by updates, patches and/or service packs
released by third parties after the date of publication of this document. Epicor® is a registered trademark and/or
trademark of Epicor Software Corporation in the United States, certain other countries and/or the EU. All other
trademarks mentioned are the property of their respective owners. Copyright © Epicor Software Corporation 2015.
All rights reserved. No part of this publication may be reproduced in any form without the prior written consent of
Epicor Software Corporation.

ED837905
90521-10-9205-583101001
10.1
Revision: December 01, 2015 5:03 p.m.
Total pages: 71
course.ditaval
Advanced Embedded Customization Course Contents

Contents
Advanced Embedded Customization Course........................................................................6
Before You Begin....................................................................................................................7
Audience.........................................................................................................................................................7
Prerequisites....................................................................................................................................................7
Environment Setup..........................................................................................................................................8
Workshop Constraints..............................................................................................................................9
Customization Overview......................................................................................................10
The Script Editor...................................................................................................................11
Script Editor Context Menu............................................................................................................................12
Event Handlers...............................................................................................................................................12
Workshop - Review the Script Editor..............................................................................................................14
Launch a Customization.........................................................................................................................15
Review the Default Script........................................................................................................................16
Identify Scripting Regions........................................................................................................................17
Use the Test Code Feature......................................................................................................................17
Customization Tools Menu..................................................................................................19
ToolBox.........................................................................................................................................................19
Workshop - Add the PictureBox Control.................................................................................................20
Create a Picture Box........................................................................................................................20
Set Up the Handler for the PictureBox..............................................................................................21
Author a Routine.............................................................................................................................21
Add the Image and Test the Part.....................................................................................................24
Assembly Reference Manager........................................................................................................................25
Workshop - Create Assembly References................................................................................................26
Custom Object Explorer.................................................................................................................................27
Workshop - Review the Custom Object Explorer.....................................................................................27
Access the Custom Object Explorer..................................................................................................28
Review EpiTransaction Objects.........................................................................................................28
Review Session Objects....................................................................................................................29
Review the ICustomScriptManager Object.......................................................................................29
Review EpiDataView Objects............................................................................................................30
Review Adapters..............................................................................................................................31
Options Menu................................................................................................................................................32
Workshop - Explore the Options Menu...................................................................................................32
Custom XML Editor........................................................................................................................................33
Workshop - Review the Custom XML Editor............................................................................................33
String Manager..............................................................................................................................................33
Workshop - Create Custom Strings.........................................................................................................34
Foreign Key Views..........................................................................................................................................35
Workshop - Create Foreign Key View......................................................................................................36

Epicor ERP | 10.1 3


Contents Advanced Embedded Customization Course

Create Foreign Key View.................................................................................................................36


Add a Like Property.........................................................................................................................37
Add an Image Column....................................................................................................................37
Add a Custom Sheet.......................................................................................................................38
Display Foreign Key View Data.........................................................................................................38
Custom Code Wizards..........................................................................................................40
Workshop - Use the Business Logic Assembly Reference Wizard.....................................................................40
Workshop - Use the Extended Property Wizard..............................................................................................41
Create the Customization.......................................................................................................................41
Launch The Extended Property Wizard....................................................................................................42
Test the Custom Code............................................................................................................................42
Workshop - Use the Add User Defined Table as Child Wizard.........................................................................43
Create the Customization.......................................................................................................................43
Test the User-Defined Table....................................................................................................................44
Workshop - Add a Custom Search Program...................................................................................................45
Add Extended User Defined Fields...........................................................................................................45
Regenerate Data Model..........................................................................................................................46
Add Controls to the Form.......................................................................................................................47
Use the Event Wizard..............................................................................................................................48
Add Text Fields.......................................................................................................................................48
Launch the Simple Search Wizard...........................................................................................................49
Finish the Customization.........................................................................................................................49
Test the Customization...........................................................................................................................50
Business Activity Queries and Dashboards.........................................................................51
Workshop - Part Image BAQ Zone..................................................................................................................51
Create Part Images.................................................................................................................................51
Create the BAQ......................................................................................................................................52
Define Calculated Field...........................................................................................................................53
Create the Customization.......................................................................................................................54
Test the BAQ Zone..................................................................................................................................55
Workshop - Work with Embedded Dashboards..............................................................................................55
Add a New Sheet....................................................................................................................................56
Define Publish/Subscribe Options............................................................................................................57
Test the Dashboard.................................................................................................................................57
Workshop - Add a Dashboard to the MES Menu............................................................................................58
Create a Simple Dashboard.....................................................................................................................58
Deploy the Dashboard............................................................................................................................59
Create a New Menu Option....................................................................................................................59
Refresh the Session.................................................................................................................................60
Create an MES Developer Icon................................................................................................................60
Customize a Blank Button.......................................................................................................................61
Use the Form Event Wizard.....................................................................................................................61
Test the Customization...........................................................................................................................64
Environment Information....................................................................................................65

4 Epicor ERP | 10.1


Advanced Embedded Customization Course Contents

Modify Infragistics® Components..................................................................................................................65


Debugging in Visual Studio............................................................................................................................65
Non-Customizable Forms...............................................................................................................................66
Customization/Personalization Maintenance.....................................................................67
Workshop - Use Customization/Personalization Maintenance.........................................................................67
Export a Customization...........................................................................................................................67
Import a Customization File....................................................................................................................68
Review and Verify the Imported Customization File.................................................................................69
Conclusion.............................................................................................................................70

Epicor ERP | 10.1 5


Advanced Embedded Customization Course Advanced Embedded Customization Course

Advanced Embedded Customization Course

Through this course you will explore customization techniques that go beyond the basics of text boxes and grids.
It examines how to customize a program using the C# programming language, introducing several wizards that
help you generate custom C# code.
Through embedded customization, you can modify aspects of your interface and application functionality. You
can then customize the Epicor ERP application to meet the needs of specific users, your organization, or your
industry.
Upon successful completion of this course, you will be able to:
• Identify the tools you use to create embedded customizations.
• Explore how you customize a program using the C# programming language.
• Use the Form Event Wizard to create a routine and assign it to the appropriate event handler.
• Use the Sheet Wizard to embed a dashboard into a form.
• 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.
• Locate the methods and properties of a common business object in the Custom Object Explorer.
• Learn how to leverage Business Activity Query (BAQ) Zones to display data related to a selected field.
• Use Customization Maintenance to verify the controls and code associated with a specific customization.

6 Epicor ERP | 10.1


Advanced Embedded Customization Course Before You Begin

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
• Managers
• Individuals responsible for improving the user experience for the Epicor ERP application.

Prerequisites

To complete the workshops in this course, the necessary modules must be licensed and operating in your training
environment. For more information on the modules available, contact your Epicor Customer Account Manager.
It is also important 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 available in two user
interface modes - Classic Menu and Modern Shell Menu. Workshops focus on each of these modes 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. It also explains how to modify program interfaces to
match your preferences.
• Embedded Customization Course - This course explores the customization tools embedded within the
Epicor ERP application. Unlike personalization, users can customize a form and then make it available to
multiple users in a company.
• 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 as well as join type definitions and specifications.
• Some of the material in this course addresses object oriented programming conventions and specifically, 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 C# programming.
• Previous course work in .NET framework with an understanding of namespaces.
• Additional information from Microsoft® Developer's Network.
• The Epicor ICE Customization Guide available from EPICWeb.

Epicor ERP | 10.1 7


Before You Begin Advanced Embedded Customization Course

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 epicor/epicor. 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 Education (EPIC06).

4. From the Main menu, select the Main site.

Important The Adding Dashboards to the MES workshops required both the MES Collection Module
and Collection User licenses. Be sure both licenses are installed and active on the training environment.
These licenses must be installed for the Epicor Education (EPIC06) company.

Cloud Specific Information


Note If your Epicor installation is not an on-premise (hosted within your organization) installation, then
note the following about using the Epicor-hosted education database. All logins referenced in the course
(such as manager, or epicor) should be changed to be the <site ID>_<abbreviationOfCompanyID>-. For
example, if your site ID is 98315 and you are logging into the Education company EPIC06, then wherever

8 Epicor ERP | 10.1


Advanced Embedded Customization Course Before You Begin

you are instructed to use the login manager, instead use 98315_E6-manager. The password is the same
as the login name.

Note To refresh your Epicor training database, send a request that includes your site ID to
[email protected]. Refreshing your training database may take up to 72 hours after the
request is received.

Workshop Constraints

Below is a list of workshops in this course that can be performed only once in each instance of a restored (refreshed)
shared database. Where applicable, a detailed explanation of the workshop constraints is documented in the
workshop itself.
For the purpose of this course, it is important to follow the steps provided in each workshop. While this course
provides education on the customizing functionality, it is essential that activated customizations in the course
are deactivated or removed when the course is complete. Removing these customizations ensures the appropriate
default training environment is available.

Epicor ERP | 10.1 9


Customization Overview Advanced Embedded Customization Course

Customization Overview

You use customization to change a program user interface (UI) to more effectively match the needs of a specific
company or workflow.
A customization is an interface layer you can modify and then make available to users in a specific company.
While you can create basic customizations that hide or add fields, this functionality includes more advanced C#
coding language features that can extend the form events and other interface capabilities for many purposes
you may need. This course explores these features and tools.
Customization is one of several tool sets available that modify different aspects of the Epicor ERP application.
The Customization functionality contains the tools for modifying user interface components that you then save
to the server and make available to users in a specific company. These interface modifications affect client side
display and logic. If you wish to modify how certain programs display and users enter data so the interfaces better
reflect your specific business, the customization tools can greatly help you meet these requirements.
However if you need to validate and monitor data, consider developing Business Process Management (BPM)
methods instead. A BPM method monitors the data entering the application. When specific conditions are met,
the method launches an action like an alert message, validation routine, or other item. Similarly, if you need to
retrieve, consume, or publish data between the Epicor ERP application and an external application, consider using
the Service Connect application to address these needs.

10 Epicor ERP | 10.1


Advanced Embedded Customization Course The Script Editor

The Script Editor

The Script Editor is a complete development environment. Use the Script Editor to make code level customizations
to the current form.
The Script Editor includes tools you use 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
previously created customizations.
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 C# coding conventions:
Control ctrl=csm.GetNativeControl("ueieieieiiss....");
The example below shows the same method when casting to a specific control:
EpiUltraCombo eucSales=(EpiUltraCombo)csm.GetNativeControl("...");

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) - The ForeignKeyView name; it must be unique.

2. dsData (DataSet) - An empty DataSet of the Foreign Key Views Type.

3. TableName (String) - Represents the table name that corresponds to the view in the DataSet.

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


DataSet dsData=(DataSet)ud01Adapter.UD01Data;
ForeignKeyDataView fkvUD01=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.

Epicor ERP | 10.1 11


The Script Editor Advanced Embedded Customization Course

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


Csm.NotifyForeignKeyView("UD01",(DataSet)ud01Adapter.UD01Data, "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 - Use this menu 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.
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.

12 Epicor ERP | 10.1


Advanced Embedded Customization Course The Script Editor

The DestroyCustomCode() handler does the following:


• Cleans up 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 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:
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.
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.

Epicor ERP | 10.1 13


The Script Editor Advanced Embedded Customization Course

[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 ERP 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()

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

14 Epicor ERP | 10.1


Advanced Embedded Customization Course The Script Editor

Launch a Customization

1. Click the arrow at the bottom of the Epicor ERP window.


A toolbar displays. Notice a series of buttons appear on the left side of this toolbar.

2. Select the Developer Mode (the wrench icon) button. A line appears through the wrench button, indicating
Developer Mode is active.
You can also activate Developer Mode through the Settings tile. From the Home screen, click Settings.
Verify General Options display, and then click Developer Mode.
Tip If you use the Classic Menu, you activate Developer Mode from the Main Menu. Either click the
Developer Mode button on the top toolbar or click Options > Developer Mode.

3. Return to the Home screen and click the Menu button.

4. Make sure you are in the Epicor Education company. Navigate to Sales Order Entry.
Menu Path: Sales Management > Order Management > General Operations > Order Entry

5. If the Process Calling dialog box displays, click OK.

6. In the Select Customization window, select the Base Only check box and click OK. This begins a new
customization with a clean form. Besides excluding customizations, it also excludes personalizations.
The Sales Order Entry form displays.

7. From the Tools menu, select Customization.

8. Navigate to the Script Editor sheet and maximize the window.

9. 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 - Two code options display - C# and VB. C# is selected by default and must be used
on all new customizations. The VB option is only available to provide backward compatibility for older
customizations.
Important All previous VB customizations should eventually be migrated to use the C# language
instead.

• Current Sheet - This sheet displays system and custom code. The lines of code are numbered.
• Comments - These are lines of text that define specific sections of code but are not part of the code
itself. It is recommended you use comments to describe custom code; this will help you and other
individuals correct issues and make modifications in the future. The very first comments in a script appear
with the module definition.
Below is a sample of comment lines which always display in green on the screen.
public static class Script
{
// ** 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 **

Epicor ERP | 10.1 15


The Script Editor Advanced Embedded Customization Course

Review the Default Script

1. In the Script Editor sheet, verify the C# code option is selected.


// **************************************************
// Custom code for SalesOrderForm
// Created: 1/16/2015 10:58:56 AM
// **************************************************
SECTION 1
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Erp.UI;
using Ice.Lib;
using Ice.Adapters;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;

SECTION 2
public class 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
public void InitializeCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable
Initialization' lines **
// Begin Wizard Added Variable Initialization

// End Wizard Added Variable Initialization

// Begin Wizard Added Custom Method Calls

// End Wizard Added Custom Method Calls


}

SECTION 5
public void DestroyCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object
Disposal' lines **
// Begin Wizard Added Object Disposal

// End Wizard Added Object Disposal

16 Epicor ERP | 10.1


Advanced Embedded Customization Course The Script Editor

// Begin Custom Code Disposal

// End Custom Code Disposal


}
}

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 these import statements are 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. 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.

4. Examine SECTION 3: Wizard-Added variables and Custom Level variables


An area that begins with '// (VB.net) or // (C #) 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.
Note Each of this area and the following areas determine variables placement and scripts to author
code. Foreign-key views and other variables are added automatically.

5. Examine SECTION 4: Wizard-Added Variable Initialization and Custom Method Calls


The Sub InitializationCustomCode() indicates the beginning of code and methods for a specific routine.

6. Examine SECTION 5: Destroy Custom Code


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

Use the Test Code Feature

You can test the code and review the results in the Output pane. You can then debug your code and retest to
validate you resolved the errors.
Use the compiler to check for syntax errors and other problems in the code. Most code can compile immediately,
but more complex code may require you to exit the form.

1. From the Tools menu, select Test Code.

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.

Epicor ERP | 10.1 17


The Script Editor Advanced Embedded Customization Course

In this example, no custom code is entered, so the compile displays Custom Code Compiled Successfully.
However if errors occur, you can click on the Error List tab to review the errors and find their location in
the code.

3. Close the Customization Tools Dialog window.

4. When asked to save changes, click No.

5. Exit Sales Order Entry.

18 Epicor ERP | 10.1


Advanced Embedded Customization Course Customization Tools Menu

Customization Tools Menu

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.
The Tools menu contains the following options:
• ToolBox - Use the toolbox to add text boxes, labels, grids, and other elements to the user interface. Each
element is bound to a database value. Though this course uses a few of the options available in the ToolBox,
the Embedded Customization course explores this feature in more detail.
• Assembly Reference Manager - An assembly is sometimes referred to as a package. These are .dll files that
contain 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 displays detailed information about business objects. Use this window
to explore UI Objects, Data Objects, and Adapters.
• Script Editor - The Script Editor displays 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. The 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 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 elements on the form
such as text boxes, grids, check boxes, and so on.
The following toolbox elements are used in this course:
• EpiTextBox - The element that captures and stores string values; users enter text in these fields.
• EpiButton - A button element users click to launch specific actions. This element works in tandem with the
Form Event Wizard to set up the event handled by the button.
• EpiCombo - The element that displays as a drop-down list. The options available on this drop-down list
populate through values specified in a table.
• EpiGroupBox - A visual element you use to group together related sheet elements.
• EpiDateTimeEditor - An element users select to capture date/time values; these values are saved with a
record.
• EpiPicture Box - Use this element display images on the custom program.
• EpiLabel - Use this element to enter text that identifies the purpose for another element such as an EpiText
Box. The label element can be linked to another element, and these two elements move as a pair on the
custom form.

Epicor ERP | 10.1 19


Customization Tools Menu Advanced Embedded Customization Course

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.

Workshop - Add the PictureBox Control

For the following workshop scenario, inventory control requests that pictures of the parts be included in part
master records when possible.
To create this customization, you use the Form Event Wizard to modify the Part Maintenance interface. 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.
Important This workshop assumes the Developer Mode is active and you are logged in with appropriate
permissions to generate customizations.

Create a Picture Box


Navigate to Part Maintenance.
Menu Path: Production Management > Job Management > Setup > Part

1. If the Process Calling dialog box displays, click OK.

2. In the Select Customization window, select the Base Only check box and click OK. This begins a new
customization with a clean form.
Part Maintenance launches; verify the Part > Detail sheet displays.

3. From the Tools menu, select Customization.


The Customization Tools Dialog window displays.

4. From the Tools menu, select ToolBox.


The ToolBox window displays.

5. Select the epiPictureBox; click and drag out a picture box in the space next to the Part, Description, Type,
and UOM Class fields.

6. If the Select Layer Type window appears, select Customization and click OK. This window only displays
for partner organizations that can create verticalizations and other custom layer types. If your company is
not a partner organization, this window does not display.

7. Adjust the handles on the picture box to make it as large as possible in the available space.

8. Now in the Customization Tools Dialog, on the Properties sheet, in the Name property, enter
picPartAttachment.

The Name property automatically generates when the new element is created using "epi" as the first three
characters. You can only change this Name property at the time you create the field. If you want to enter a unique
name for the element to make it easier to write code against later, you need to enter this unique name now.
After you insert the picture box, you use handlers to execute the code.

20 Epicor ERP | 10.1


Advanced Embedded Customization Course Customization Tools Menu

Set Up the Handler for the PictureBox


This example uses two handlers to ensure the code executes based on some form events. Use the EpiDataView
notification as well as the ListChanged event handlers to trigger the picture box to display the graphics file
attached to the part record.

1. In the Customization Tools Dialog window, navigate to the Wizards > Form Event Wizard sheet.

2. In the Select Event Type field, select ListChanged.

3. In the View field, select AutoAttachPart.

4. Click the Right Arrow button to add the event.


The new event moves to the event listing.

5. Click the Update All Event Code button.

6. Click Save.
The Save Customization window displays.

7. In the Name and Description fields, enter XXXpicPart (where XXX are your initials) and click Save.

8. In the Customization Comment window, enter Part Master w/Picture and click OK.
The Epicor ERP 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. Maximize the Customization Tools Dialog window and navigate to the Script Editor sheet.

2. Add the line of code in bold below to declare a string filename variable:
// Add Custom Module Level Variables Here **
private static string mFileName;
public void InitializeCustomCode()

3. Add the line of code in bold below to initialize the filename variable:
// Begin Wizard Added Variable Initialization

this.AutoAttachPart_DataView = this.AutoAttachPart_Row.dataView;
this.AutoAttachPart_DataView.ListChanged += new
ListChangedEventHandler(this.AutoAttachPart_DataView_ListChanged);
mFileName = String.Empty;

4. Enter the following code after the public void DestroyCustomCode() code block, directly below the last
} character. Note that lines of code which are not indented indicate code that continues from the previous
line.
private void SetPictureBoxIconFromAttachment()
{
//Get reference to part attachment view
EpiDataView edvPartAttach =
(EpiDataView)oTrans.EpiDataViews["AutoAttachPart"];
if (((edvPartAttach !=null)&&(edvPartAttach.dataView.Count > 0)))
{

Epicor ERP | 10.1 21


Customization Tools Menu Advanced Embedded Customization Course

string
fileName=edvPartAttach.dataView[0]["Filename"].ToString();
if ((mFileName !=fileName))
{
mFileName = fileName;

picPartAttachment.Image=System.Drawing.Image.FromFile(fileName);
}
else
{
mFileName=string.Empty;
picPartAttachment.Image=null;
}
}
}

5. Below the existing // ListChangedType.ItemAdded, ListChangedType.ItemChanged,


ListChangedType.ItemDeleted, ListChangedType.ItemMoved, ListChangedType.Reset handler, add the line
of code in bold below to call the method you just authored.
// Add Event Handler Code
SetPictureBoxIconFromAttachment();

6. Navigate to Wizards > Form Event Wizard.

7. From the Select Event Type drop-down list, select ToolClick.

8. Click the Right Arrow button.

9. Click the Update Selected Event Code button.

10. Navigate to the Script Editor and locate the private void baseToolbarsManager_ToolClick(object sender,
Infragistics.Win.UltraWinToolbars.ToolClickEventArgs args) handler. Enter the following code:
{
switch (args.Tool.Key)
{
case "DeleteTool":
case "ClearTool":
mFileName=string.Empty;
picPartAttachment.Image=null;
break;
}
}

11. Click Save.

12. Verify the syntax is correct. Click Tools > Test Code.
Resolve any errors. If the code is correct, the Output pane displays **Custom Code Compiled
Successfully.**

13. If the compile is successful, click Save and close the Customization Tools Dialog window.

14. Exit Part Maintenance.

22 Epicor ERP | 10.1


Advanced Embedded Customization Course Customization Tools Menu

When you finish entering the code, it looks like the following example. Note that lines of code which are not
indented indicate code that continues from the previous line.
// **************************************************
// Custom code for PartForm
// Created: 9/25/2013 12:26:39 PM
// **************************************************
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Erp.UI;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;

public class Script


{
// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module
Level Variables' Comments! **
// Begin Wizard Added Module Level Variables **

private DataView AutoAttachPart_DataView;


// End Wizard Added Module Level Variables **

// Add Custom Module Level Variables Here **


private static string mFileName;
public void InitializeCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added V
ariable Initialization' lines **
// Begin Wizard Added Variable Initialization

this.AutoAttachPart_DataView = this.AutoAttachPart_Row.dataView;
this.AutoAttachPart_DataView.ListChanged += new ListChangedEventHandle
r(this.AutoAttachPart_DataView_ListChanged);
mFileName = String.Empty;
this.baseToolbarsManager.ToolClick += new Infragistics.Win.UltraWinToo
lbars.ToolClickEventHandler(this.baseToolbarsManager_ToolClick);
// End Wizard Added Variable Initialization

// Begin Wizard Added Custom Method Calls

// End Wizard Added Custom Method Calls


}

private void SetPictureBoxIconFromAttachment()


{
//Get reference to part attachment view
EpiDataView edvPartAttach = (EpiDataView)oTrans.EpiDataViews["AutoAttachPa
rt"];
if (((edvPartAttach !=null)&&(edvPartAttach.dataView.Count > 0)))
{
string fileName=edvPartAttach.dataView[0]["Filename"].ToString()
;
if ((mFileName !=fileName))
{
mFileName = fileName;
picPartAttachment.Image=System.Drawing.Image.From
File(fileName);
}

Epicor ERP | 10.1 23


Customization Tools Menu Advanced Embedded Customization Course

else
{
mFileName=string.Empty;
picPartAttachment.Image=null;
}
}
}

private void baseToolbarsManager_ToolClick(object sender, Infragistics.Win.Ultr


aWinToolbars.ToolClickEventArgs args)
{
switch (args.Tool.Key)
{
case "DeleteTool":
case "ClearTool":
mFileName=string.Empty;
picPartAttachment.Image=null;
break;
}
}

public void DestroyCustomCode()


{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Objec
t Disposal' lines **
// Begin Wizard Added Object Disposal

this.AutoAttachPart_DataView.ListChanged -= new ListChangedEventHandler(th


is.AutoAttachPart_DataView_ListChanged);
this.AutoAttachPart_DataView = null;
this.baseToolbarsManager.ToolClick -= new Infragistics.Win.UltraWinToolbar
s.ToolClickEventHandler(this.baseToolbarsManager_ToolClick);
// End Wizard Added Object Disposal

// Begin Custom Code Disposal

// End Custom Code Disposal


}

private void AutoAttachPart_DataView_ListChanged(object sender, ListChangedEven


tArgs args)
{
// ** Argument Properties and Uses **
// AutoAttachPart_DataView[0]["FieldName"]
// args.ListChangedType, args.NewIndex, args.OldIndex
// ListChangedType.ItemAdded, ListChangedType.ItemChanged, ListChangedType
.ItemDeleted, ListChangedType.ItemMoved, ListChangedType.Reset
// Add Event Handler Code
SetPictureBoxIconFromAttachment();
}
}

Add the Image and Test the Part


To populate the Part Maintenance with the image, add the image as an attachment to the specific part record.
If you are taking this course live, the education environment contains the image you need to complete the
workshop. However if you are working with the embedded version of this course, use a small .bmp graphic file
from your local machine. If you have a screen capture tool, you can take a screen capture of this image:

24 Epicor ERP | 10.1


Advanced Embedded Customization Course Customization Tools Menu

Create a new C:\_InfoZones folder and save this image in this folder. For the file name, use 1032FW.bmp.

1. Launch Part Maintenance again.

2. In the Select Customization window, select XXXpicPart (where XXX are your initials) and click OK.

3. Click the Part button to search for and select part number ADD-200-S.

4. Click the Attachments button.


The Attachments pane displays.

5. Click the New button in the Attachments pane.

6. When the Select Customization window displays, click OK.


The Attachment Management window displays.

7. Click the Browse button and navigate to C:\_InfoZones.

8. Select the 1032FW.bmp file and click Open.


This creates an attachment on the tree view.

9. On the Attachment Management window, click OK again.

10. Click Refresh.


The image displays in your picture box.

11. Exit Part Maintenance.

Assembly Reference Manager

The Assembly Reference Manager displays a list of the native assemblies you can use within the Epicor ERP
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.
Use the Assembly Reference Manager to quickly locate and add custom assembly references to a customized
form.
Customizations often call methods external to the form to bring in necessary data. Use assembly references when
you need to call an adapter from another table in the application.
Key items to remember:
• An Assembly is a piece of code that joins UI objects, data objects, and adapters. Sometimes called packages,
assemblies are .dll files that group the objects together to create a specific form.

Epicor ERP | 10.1 25


Customization Tools Menu Advanced Embedded Customization Course

• 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, Erp.Adapters.Customer.dll and Erp.Contracts.BO.Customer.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.
Available assembly types:
• Contracts.BO - This assembly type displays the business object file required for the adapter.
• Adapters - This assembly type displays the adapter code object that connects the business object to the
interface framework file.
• 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.

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 manually add custom assemblies to Customer Shipment Entry.
Navigate to Customer Shipment Entry.
Menu Path: Material Management > Shipping / Receiving > General Operations > Customer Shipment Entry

1. If the Process Calling dialog box displays, click OK.

2. In the Select Customization window, select the Base Only check box and click OK. This begins a new
customization with a clean form.
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.

26 Epicor ERP | 10.1


Advanced Embedded Customization Course Customization Tools Menu

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 Erp.Adapters.Customer.dll.

8. Repeat steps 4 - 7 to add the Erp.Contracts.BO.Customer.dll assembly.


You now have added both custom assemblies (Adapters, Contracts) that you need. Notice two other assembly
types display in this Custom Assembly Reference Manager:
• System Assemblies - Assemblies required by the Microsoft® .NET environment.
• Native Assemblies - Assemblies required by the Epicor ERP application.

9. In the Custom Assembly Reference Manager window, click OK.

10. Close the Customization Tools Dialog. If you are asked to save the customization, click No.

11. Exit Customer Shipment Entry.

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 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 an 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 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 help you write the C# subroutines you need to complete customizations.
They illustrate how you can begin writing the C# subroutine you need.

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.

Epicor ERP | 10.1 27


Customization Tools Menu Advanced Embedded Customization Course

• 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. Use this code snippet as an example for your
custom code.

• Data Objects - This represent the data captured from the Epicor ERP 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. If the Process Calling dialog box displays, click OK.

2. In the Select Customization window, select the Base Only check box and click OK. This begins a new
customization with a clean form.
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.

5. Maximize the Custom Object Explorer.

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 the EpiDataViews in the Transaction object. An EpiDataView
displays data from a specific table or form.

3. Return to the Transaction node and 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 a method that begins with GetNew...().

28 Epicor ERP | 10.1


Advanced Embedded Customization Course Customization Tools Menu

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 site 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 Code example.
' ** Get Property
Dim [varName] As String = JobEntryForm.Session.UserID
Example When writing 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 object to define global variables from the script. The object 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. Note this is a single line of code:
Control ctrl = csm.GetNativeControlReference ("5483cdef-3049-4705-b597-28ae
93bc7fdf");
The example below shows use of the method when casting to a specific control type. Note this is a single
line of code:
EpiUltraCombo eucSales = (EpiUltraCombo ) csm.GetNativeControlReference(“54
83cdef-3049-4705-b597-28ae93bc7fdf”);

3. From the list, select the AddForeignKeyView method.


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. When you use this method, you must define the following parameters:
• Parameter: ViewName (String) - This is the name of the Foreign Key View and must be unique.
• Parameter: dsData (DataSet) - This is an empty DataSet of the Foreign Key Views Type.

Epicor ERP | 10.1 29


Customization Tools Menu Advanced Embedded Customization Course

• Parameter: TableName (String) - This represents the name of the table that corresponds with the view
in the DataSet.
The following lines of C# code demonstrate this method:
// Add Adapters Table to List of Views

// This allows you to bind controls to the custom child view


Dataset dsData = (DataSet)ud01Adapter.UD01Data;

ForeignKeyDataView fkvUD01 = 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 line of C# code also demonstrate the use of this method:
// notify with updated data
csm.NotifyForeignKeyView("UD01", (Dataset )ud06Adapter.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("AutoAttachJobA
smblAttchAssembly"), EpiDataView)

5. The second row displays how to access or set a value in the EpiDataView:
Dim [VarName] As Int32 = [edvVarName].dataView([edvVarName].Row)("AssemblyS
eq")

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.

9. Select the DueDate field and in the code box, review the code sample.

30 Epicor ERP | 10.1


Advanced Embedded Customization Course Customization Tools Menu

Tip You can copy these lines into the Script Editor for faster coding.

You must 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 C# subroutines necessary to complete
customization projects.
An example of the InitializeCustomCode() method is below. You can use this method to extend the object
properties. The following code extends the JobNum field properties inside the JobHead EpiDataView. The
C# code is as follows:

private static void SetExtendedProps()


{
// Get EpiDataView reference
Dim edv As EpiDataView = CType(oTrans.EpiDataViews("JobHead"), EpiDataVi
ew)

if (edv.dataView.Table.Columns.Contains("JobNum"))
{
edv.dataView.Table.Columns["JobNum"].ExtendedProperties["ReadOnly"] = t
rue
edv.dataView.Table.Columns["JobNum"].ExtendedProperties["Enabled"] = fa
lse

// or to make invisible...

//edv.dataView.Table.Columns["JobNum"].ExtendedProperties["IsHidden"] =
false
}
}
Tip The reference // or to make invisible... in the above code demonstrates how you can manually
hide a field. An Extended Properties wizard is also available to manipulate these properties; this
wizard is discussed later in the course.

Review Adapters
Data adapters are bridges between datasets and datasources. Without an adapter, a dataset cannot access data
sources.
The data adapter takes care of 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 the adapters display.

Epicor ERP | 10.1 31


Customization Tools Menu Advanced Embedded Customization Course

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 (stringId As System.String) method.


The Return Type of the method, Parameters (if any), and a VB.Net Example that demonstrates how you
can use it in a C# script displays.
In this example, the return type is a Boolean value that takes the parameter that represents the stringId
value. The GetByID method in this case assists in writing a script where you must validate data based on the
existence of a specific string.
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.

Options Menu

The Tools > Options sub-menu contains an series of customization mode settings you can adjust to match your
preferences.

Workshop - Explore the Options Menu

1. Within the Customization Tools Dialog, click Tools > Options to display this sub-menu.

2. Select the Top Most option to indicate you want the Customization Tools Dialog to always display on top
of the form. If you clear this check box, the Customization Tools Dialog displays behind the form.

3. Now highlight the Grid Settings submenu. You see two options:

a. Selecting the GridSize option causes the Grid Options Dialog to display. Use the Grid Width and Grid
Height fields to define the distribution of the grid dots on the form on your customization. Enter 4 in
both values and click OK.
Notice the grid dots pull together on the Job Entry form.

b. Select the Snap To Grid option to help position custom elements (check boxes, fields, and so on) when
you add them to your form. When this option is selected, the elements pull, or snap, towards the grid
dots.

32 Epicor ERP | 10.1


Advanced Embedded Customization Course Customization Tools Menu

Tip By entering a smaller grid size and then activating the Snap to Grid feature, you can more precisely
place your custom check boxes, fields, radio buttons, and other elements onto your custom form.

4. By default, the Customization Comment dialog box displays each time you save a customization; this
dialog automatically creates a date/time stamp. If you do not want this dialog box to appear, select the
Suppress Save Comment Dialog option. For the purposes of this course, select this option.
Now each time you save a customization, the Customization Comment window will no longer display.

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 help correct issues that occur within the customization.

Workshop - Review the Custom XML Editor

1. Within the Customization Tools Dialog, click Tools > Custom XML Editor... to display this window.
The Custom XML Editor Dialog displays. The layers of the XML behind the customized form display in a
true XML layout.

2. The XML View sheet appears by default. Use this sheet to display a read-only view of the XML code. You
can then view the entire XML code for the current form.

3. Click the Custom Controls tab. 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 used for 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.

4. Now click the Custom Properties sheet. 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.

5. When you finish reviewing the Custom XML Editor, click Cancel.

6. Close the Customization Tools Dialog.

7. When asked to save changes, click No.

8. Close Job Entry.

String Manager

Use the String Manager to create customizable strings for translation, you can then use these strings for text
boxes, warning boxes, labels, and so on.
Certain commonly used phrases within reports do not translate into other languages. However the String Manager
tags certain phrases and customizes their translation for future use. Because of this, you can use the String

Epicor ERP | 10.1 33


Customization Tools Menu Advanced Embedded Customization Course

Manager to add additional features like pop-up windows, labels, warnings, and other elements. All of these
additional features have the ability to be custom translated to fit your business needs.

Workshop - Create Custom Strings

Follow the steps below to create a customizable text box. When you use this text box with the Translation Utility,
you will be able to translate the text box as you need. The steps below show how the String Manager works in
Sales Order Entry. The String Manager has several uses, and this Sales Order Entry customization is one such
example.

1. Navigate to Sales Order Entry.


Menu Path: Sales Management > Order Management > General Operations > Order Entry

2. If the Process Calling dialog box displays, click OK.

3. In the Select Customization window, select the Base Only check box and click OK.

4. Select Tools > Customization.


The Customization Tools Dialog displays.

5. Select Tools > String Manager.


The Custom String Dialog window displays.

6. The top of this window displays the syntax you need to use to create your custom string. Although both C#
and VB syntax displays, you should only use the C# syntax. The VB syntax is provided for backward
compatibility with older customizations.

7. Click the New button.

8. Enter a String Key value; a String Key can be an identifier for the sentence or phrase being translated. For
this example, enter YourID.

9. Now enter a String Value. A String Value is the actual sentence or phrase you wish to translate. For this
example, enter Your ID (notice this value includes a space).

10. Click Add/Update.


The string now displays in the Existing Strings box. As you add more strings to translate, they display in
this list box.
Note To remove a string from the list, highlight it and click Delete.

11. When you finish adding the strings, click Close.

12. In the Customization Tools dialog box, select the Script Editor tab.

13. Scroll down to the public void DestroyCustomCode() section.

14. Locate the //End Custom Code Disposal comment. Click next to this comment and press <Enter>.

15. Add the following code line: MessageBox.Show(Script.GetStringByID(“YourID”));


Note Notice the "YourID" value is the String Key you created.

34 Epicor ERP | 10.1


Advanced Embedded Customization Course Customization Tools Menu

16. Click Save.


The Customization Save dialog box displays.

17. In the Name field, enter XXXStrings and in the Description field, enter XXX String Test (where XXX are
your initials).

18. Click Save.

19. Close the Customization Tools Dialog window and Sales Order Entry.

20. Launch Sales Order Entry again, select the XXXStrings customization (where XXX are your initials), then click
OK.

21. After Sales Order Entry displays, close this program again.
A message displays that shows the "Your ID" String Value you created.

22. Click OK.

The String Manager interfaces with the Translation Utility. After you enter strings of custom phrases, launch the
Translation Utility to complete your local language customization. The Translation Utility is a tool you use to
manually update program text so it accurately translates into the current language. If some program text does
not translate properly into this language, use this tool to enter the correct text strings and update the interface.
To learn more about the Translation Utility, review the application help or the Localization chapter within the ICE
Customization User Guide.

Foreign Key Views

A Foreign Key View is a link to a separate, or foreign, table that contains logically similar data to the main table
used on the form. You use the Custom Data Dialog to create foreign key views.
Leverage this functionality to link related tables together so they display the information you need. You can create
foreign key views for any dataView, or table, that has a field you use to search by its record GetByID identifier.
You first create the foreign key view and then add the Like property to a specific field. Fields that logically link
to foreign key fields in other tables all must share the Like property. The Like property defines which foreign keys
can link to other tables. Additionally, you can add an image column to the foreign key view to display various
icons you want to associate with the data.
After you have set up the foreign key view, you can then link custom fields to this view, displaying its data within
any custom fields you create on the form. 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. The data you
display through a Foreign Key View is read-only; users cannot edit this data. A powerful tool, use this functionality
to link related tables together so they display the information you need on your customization.
You can set up a variety of table combinations. You can first create one foreign key view and then link another
sub-view to this view, another sub-view to this sub-view, and so on. As long as you can establish a logical
connection between the Parent and Child columns through their Like properties, you can display data through
nearly any combination of views.

Epicor ERP | 10.1 35


Customization Tools Menu Advanced Embedded Customization Course

Workshop - Create Foreign Key View

The following exercises illustrate how you create a foreign key view for Purchase Order Entry. You will add a new
sheet that displays supplier detail information within Purchase Order Entry.

Create Foreign Key View

When you add a Foreign Key View to your customization, this view can then be selected as a DataSource value
for any custom fields you create.

1. Navigate to Purchase Order Entry.


Menu Path: Material Management > Purchase Management > General Operations > Purchase Order Entry

2. If the Process Calling dialog box displays, click OK.

3. In the Select Customization window, select the Base Only check box and click OK.

4. Select Tools > Customization.


The Customization Tools Dialog displays.

5. In the Customization Tools Dialog, from the Tools menu, select Data Tools.
The Custom Data Dialog window displays.

6. Click the New Custom View button.


The Custom View Info fields activate.

7. Enter the View Name you want for the new foreign key view. For this example, enter SupplierDetail.

8. If this view will be a sub-table view (Child) to a Parent View, use the Parent View Name list to select this
table. Because you want to pull in information from the supplier record selected on the purchase order, you
select POHeader parent table on this list.
Notice the View Type field indicates what kind of view you are adding. For this example, it displays Foreign
Key View.

9. Click the Column Name drop-down list to select the GetByID record identifier you need to pull in the table’s
data. You are pulling in data from supplier records, so you select the VendorVendorID option – the supplier
identifier value. Notice values populate in the remaining fields on this sheet:

a. The Like Column Value field displays the Like property value that is shared, in this example, between
the POHeader table and the SupplierDetail foreign key view. This value, Vendor.VendorID, causes these
two tables to display related data on the current form.

b. The Adapter Name displays the database routine that pulls the foreign key view data into the current
form. In this case, the VendorAdapter is the routine that pulls in customer data into forms throughout
the application.

c. The Get By Type list displays the method the foreign key view uses to pull data out of its table. Because
you need this foreign key view to first pull in data through the customer identifier (ID), you use the
StringGetByID method.

10. To add this foreign key view to your customization, click the Add button.

11. If the foreign key view was successfully added, the Foreign Key View dialog box displays. Click OK in this
dialog box.

36 Epicor ERP | 10.1


Advanced Embedded Customization Course Customization Tools Menu

Notice the new foreign key view displays in the Custom Views list. It starts with the abbreviation FKV, followed
by the View Name you entered.
If you are displaying this course through the course window, you will need to close the Custom Data Dialog to
advance to the next workshop. To do this, click OK.

Add a Like Property

To join the POHeader table to the foreign key view, you both add and edit Like properties for selected dataViews.
Use the Custom Column Like property to create custom foreign key views.
When you define a Like property, you can then link a field from one table to a similar field on the new table that
now shares the Like property value. To display the FOB Description value through a foreign key view:

1. If you had to close the Custom Tools Dialog to advance to the next course topic, click the Tools > Data
Tools... option.
The Custom Data Dialog displays again.

2. Click the Custom Column Like tab.


The Columns with Existing Like Values grid displays the current dataViews (tables) that have Like properties.
The name of the Like property displays in the LikeValue column.

3. To add a Like property to a new dataView and column combination, select the view you need from the
Available Views list. Select the POHeader view.

4. Use the Available Columns list to select the column that needs a Like property with the selected view.
Because you want to display the FOB Description through a foreign key view, you select the FOBDescription
column.
Notice the View Name, Column Name, and Column Data Type fields displays the results of your selection.
The Column Data Type field indicates what kind of data shares the Like property. In this example, string
data is linked through this view.

5. When the dataView and the selected column do not share a Like property, the Like Column Value field is
blank. Enter the Like property in this field; for this example, enter Vendor.FOBDescription.

6. Click the Apply Like Property button.

You can now display data through this foreign key view combination. You can create a text field, for example,
that displays the FOB Description values from your supplier data.
If you are displaying this course through the course window, you will need to close the Custom Data Dialog to
advance to the next workshop. To do this, click OK.

Add an Image Column

You can also add an image column to your foreign key view. You can set this up to display an image column on
a grid.

1. If you had to close the Custom Tools Dialog to advance to the next course topic, click the Tools > Data
Tools... option.
The Custom Data Dialog displays again.

2. Click on the Custom Image Column.

3. Click the New Image Column button.

Epicor ERP | 10.1 37


Customization Tools Menu Advanced Embedded Customization Course

4. You next indicate which Data View will contain the image column. Click the Data View drop-down list and
select SupplierDetail.

5. Enter the Column Name for this new image column. For this example, enter Rank.

6. Enter the Caption that will display in the column header. Enter Supplier Rank in this field.

7. Click the Image Name drop-down list and select the default image that will display in this column. Since
you want to indicate you can purchase materials from most suppliers, you select the ZoneIndicatorGreen
image.
Tip You could later enter code that changes which image displays in the SupplierDetail.Rank column.
Depending on different conditions, you could display a different zone indicator value in this field.

8. The Visible Index indicates the position of the new column. A "0" value indicates the column displays on
the left side of the grid; a "1" value indicates it displays to the right of the first grid column.

9. Click the Update button.

10. When you finish, click OK.


The Custom Data Dialog window closes.

11. Save your customization. For the Name and Description, enter XXXSupplierDetail (where XXX are your
initials).

Add a Custom Sheet

Now you add a custom sheet and then place fields onto that sheet to display the foreign key view data. You do
this by using the Sheet Wizard.

1. In the Customization Tools Dialog, navigate to the Wizards > Sheet Wizard tab.

2. You first need to create a new custom sheet and dock it to the top level of your custom form. Click the
New Custom Sheet button.

3. Use the Dockable Sheets list to select POEntryForm.

4. In the Name, Text, and Tab Text fields, enter Supplier Detail. This text value identifies the sheet on the
interface.

5. Click the Right Arrow button to add this sheet to the Custom Sheets list.
The new sheet now displays on your custom interface.

6. Click on the Supplier Detail tab.


A blank sheet displays.

Display Foreign Key View Data

You next add custom fields, check boxes, and a grid to display information from your foreign key view.

1. From the Tools menu, select Toolbox.


The Toolbox window displays.

38 Epicor ERP | 10.1


Advanced Embedded Customization Course Customization Tools Menu

2. To display a supplier's Group on this sheet, in the Toolbox window, select the EpiTextBox control. Now
click and drag over an area of your new sheet.

3. If the Select Layer Type window appears, select Customization and click OK. This window only displays
for partner organizations that can create verticalizations and other custom layer types. If your company is
not a partner organization, this window does not display.

4. In the Customization Tools Dialog, click the Properties tab.

5. Clear the default value that displays in the Text property.

6. Use the EpiBinding list to select the SupplierDetail foreign key view and the GroupCodeGroupDesc
option.

7. Change the Size property to 120, 20.

8. Now add a Label element to the sheet. From the Toolbox, select the epiLabel option and place the label on
the form.

9. For the label's Text property, enter Supplier Group.

10. Select the text box. For the text box's epiLabel property, select the epiLabelC1 element.

11. Repeat steps 5-7 to add the following custom controls to this sheet. Be sure to clear the Text property on
all the elements:

Element EpiBinding EpiLabel Size


EpiTextBox SupplierDetail.MinOrderValue Minimum Order Value 120,20
EpiCheckBox SupplierDetail.PayHold Payment Hold?
EpiCheckBox SupplierDetail.ElecPayment Electronic Payment?

12. Now from the Toolbox, click and drag an EpiUltraGrid to the new sheet.

13. Expand the custom grid to display across the sheet.

14. For the Text property, enter Supplier Detail.

15. For the EpiBinding, select the SupplierDetail foreign key view.

16. To see these fields display the foreign key view data, save the customization.

17. Exit the customization and launch Purchase Order Entry again.

18. Select the XXXSupplierDetail customization (where XXX are your initials).

19. Open a purchase order and click the Supplier Detail tab.
Sales information from the supplier record automatically displays within your customized sheet. Notice your
custom image column displays in the Supplier Detail column. Continue to load in other purchase orders to
details on other suppliers.

20. When you finish testing your customization, close Purchase Order Entry.

Epicor ERP | 10.1 39


Custom Code Wizards Advanced Embedded Customization Course

Custom Code Wizards

Use Customization Tools Dialog > Tools > Wizards > Customization Wizards to generate custom code.
Available 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 a public method within an
adapter. You can also use it to map the input parameters required for both the method and the adapter.

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. If the Process Calling dialog box displays, click OK.

2. In the Select Customization window, select the Base Only check box 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. 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.


The available adapters display.

7. In the list, select the ABCCode Adapter.

8. In the Business Logic Assembly References Wizard window, click Finish.

40 Epicor ERP | 10.1


Advanced Embedded Customization Course Custom Code Wizards

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 the two required assemblies (Adapters, Contracts).

12. Select the Erp.Adapters.ABCCode custom assembly.


The Assembly Info section of this tool populates with information you need about the selected custom
assembly.

13. In the Custom Assembly Reference Manager window, click OK.

14. Close the Customization Tools Dialog window.

15. In the Save Confirmation window, click No.

16. Exit ABC Code Maintenance.

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.

Create the Customization


Navigate to UOM Class Maintenance.
Menu Path: Material Management > Inventory Management > Setup > UOM Class

1. If the Process Calling dialog box displays, click OK.

2. In the Select Customization window, select the Base Only check box 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.

7. If the Select Layer Type window appears, select Customization and click OK. This window only displays
for partner organizations that can create verticalizations and other custom layer types. If your company is
not a partner organization, this window does not display.

8. To the right of the System Default check box, draw the new text field.

Epicor ERP | 10.1 41


Custom Code Wizards Advanced Embedded Customization Course

9. Close the Toolbox.

Launch The Extended Property Wizard

1. Select the new epiTextBoxC1 and navigate to the Customization Tools Dialog > Properties sheet.

2. Now locate the Text property; clear the epiTextBoxC1 value in this field.
This property automatically populates with an ID value to help you locate the field on the form during
customization mode. However during runtime you do not want this ID value to display in this field.

3. Locate the EpiBinding property, set your cursor in the field, and open the list.

4. Expand the UOMClass table and double-click the Company field.


The EpiBinding property displays UOMClass.Company.

5. In the Customization Tools Dialog window, from the Tools menu, select Wizards > Customization
Wizards.
The Customization Code Wizard Dialog window displays.

6. Select the Modify Extended Properties wizard and click the Launch Wizard button.
The Extended Property Wizard window displays.

7. In the Extended Property Wizard window, in the DataView field, select UOMClass.

8. In the DataField field, select Company.

9. In the Extended Property field, select Enabled.

10. In the Value field, select True.

11. Click Finish and click Close.

12. Remain in the Customization Tools Dialog window.

Test the Custom Code

1. Navigate to the Script Editor sheet to see this code generated by the wizard:
private 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).

5. Click Save.

6. Close the Customization Tools Dialog window and exit UOM Class Maintenance.

42 Epicor ERP | 10.1


Advanced Embedded Customization Course Custom Code Wizards

7. Reopen UOM Class Maintenance.

8. In the Select Customization window, select XXXExtended and click OK.

9. Select an entry for Class ID to test the new text box.


Notice the Company information populates in your custom field.

10. Exit UOM Class Maintenance.

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.

Create the Customization


Navigate to ABC Code Maintenance.
Menu Path: Material Management > Inventory Management > Setup > ABC Code

1. If the Process Calling dialog box displays, click OK.

2. In the Select Customization window, select the Base Only check box 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. This wizard adds several sections of code to the
custom script.

11. Verify the code is correct. Click Tools>Test Code.

Epicor ERP | 10.1 43


Custom Code Wizards Advanced Embedded Customization Course

You should receive a message that the code compiled successfully. However you may receive the following
error:
• The type or namespace name 'UD01Adapter' could not be found (are you missing a using directive or
an assembly reference?)
To correct this error, navigate to the top of the script. Replace the "using Erp.UI;" code (line 10) with
the following statement:
• using Ice.Adapters;
Test the code again. It should compile successfully.

12. On the Standard toolbar, click Save.


The Customization Save Dialog window displays.

13. In the Name field, enter XXXUDTable (where XXX are your initials).

14. In the Description field, enter XXX User Defined Table (where XXX are your initials) and click Save.

15. Close the Customization Tools Dialog window and exit ABC Code Maintenance.

Test the User-Defined Table

1. Reopen ABC Code Maintenance.

2. If the Process Calling dialog box displays, click OK.

3. In the Select Customization window, select the XXXUDTable (where XXX are your initials) customization
and click OK.

4. From the Tools menu, select Customization.

5. In the Customization Tools Dialog window, from the Tools menu, select ToolBox.

6. From the ToolBox, select EpiTextBox.

7. Place the new field next to the Exclude from Cycle Count check box.
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.

44 Epicor ERP | 10.1


Advanced Embedded Customization Course Custom Code Wizards

Workshop - Add a Custom Search Program

Use the Simple Search Wizard and the Event Wizard to add a search program and search results fields to your
customization. During this workshop, you will add a Contact search program to Sales Order Entry.

Add Extended User Defined Fields

To begin, you first need to add some extended user defined fields you will later use in the customization.
You add user defined fields through Extended User Defined Table Maintenance. If your user account has Security
Manager or Global Security Manager rights, you can launch this program. Through this program, you first select
the table you wish to extend and then add the custom user defined fields you need.
Note Do not confuse extended user-defined fields with user-defined tables. Extended user-defined fields
are additional columns you add to an existing table. When you search for these table extensions, their
names include the "_c" suffix. User-defined tables are empty tables (UD01, UD22, UD100, and so on)
available in the database; you can either add these tables as grids to existing programs or add them to the
Menu to create a custom entry program.

1. Be sure you shut off Developer Mode. Click the arrow at the bottom of the Epicor ERP window.
A toolbar displays. Notice a series of buttons appear on the left side of this toolbar.

2. Select the Developer Mode (the wrench icon) button. The line no longer appears through the wrench
button, indicating Developer Mode is turned off.
You can also deactivate Developer Mode through the Settings tile. From the Home screen, click Settings.
Verify General Options display, and then click Developer Mode. The check mark no longer displays next
to this option.
Tip If you use the Classic Menu, you deactivate Developer Mode from the Main Menu. Either click
the Developer Mode button on the top toolbar or click Options > Developer Mode.

3. Return to the Menu and navigate to Extended User Defined Table Maintenance.
Menu Path: System Setup > System Maintenance > Extended UD Table Maintenance
Important This program is not available in Epicor Web Access.

4. Click the New button.


The Table Search window displays.

5. In the Starting At field, enter O. Then click Search.

6. From the Search Results grid, select the OrderHed table. Then click OK.
The tree view now displays a new OrderHed_UD node.

7. For the Description, enter Custom Columns for Simple Search. (If a value already displays in the Description
field, you can ignore this step.)

8. Click the Down Arrow next to the New button; select New Column.
The Column>Detail sheet displays.

9. Enter the Column name that will display in the column header. For this example, enter Search01.

Epicor ERP | 10.1 45


Custom Code Wizards Advanced Embedded Customization Course

10. For the Data type, select String.

11. Now for the Format, enter x(20). This indicates up to twenty characters can display in this field.
Note When a user enters data in this extended field, the application validates this entry to ensure it
matches the Data type and Format you define on this sheet.

12. Click Save.

13. Now repeat step 7-11 to add three more character fields. Use the following values:

Column name Data type Format


Search02 String x(20)
Search03 String x(20)
Search04 String x(20)

Notice that each column now has an "_c" suffix added to its column name, like Search01_c. This helps you
identify the custom column later when you need to use it.

14. When you finish created these custom user defined columns, click Save.

15. Close Extended User Defined Table Maintenance.

16. Exit the Epicor ERP application.

Regenerate Data Model

To finish adding the extended user-defined columns, the data model for the Epicor database needs to be
regenerated.
You do this task on the server that contains your database. If you do not have rights to access the server, contact
your Server Administrator. Either you or the Server Administrator does the following steps in the Epicor
Administration Console.

1. On your server machine, launch the Epicor Administration Console.

2. Expand the Database Server Management node and the database server node that contains the database
you need to update. Select the database icon.
The properties for the database displays in the center pane.

3. From the Actions pane, click the Regenerate Data Model button.
The Generate Data Model window displays.

4. Click Generate.
Note If you receive an error that the .dll file is in use by another process, end the task and close the
Epicor Administration Console. Return to the Apps screen and launch the Command Prompt (under
the Windows System section). In the Command Prompt window, enter IISRESET and press <Enter>.
After IIS stops and restarts, close the Command Prompt window and return to the Epicor Administration
Console. You should be able to regenerate the data model.

46 Epicor ERP | 10.1


Advanced Embedded Customization Course Custom Code Wizards

5. Now to complete this process, pull the latest data model from the database and copy it to the local application
server by restarting IIS. Restarting IIS is a mandatory task after the data model is successfully regenerated.
To do this, launch the Command Prompt window.

6. Enter IISRESET and press <Enter>.

7. After IIS stops and restarts, close the Command Prompt window.

The data model generates, adding the extended user-defined table to the database. The columns you created
are now available on the OrderHed table. You can bind custom elements to these columns. Epicor users can also
view and enter data in the extended user-defined table.

Add Controls to the Form

To begin creating your customization, you first need to add a button and text fields to a form.

1. Relaunch the Epicor application. For the User Name/Password, enter manager/manager.

2. Activate Developer Mode. Click the arrow at the bottom of the Epicor ERP window.
A toolbar displays. Notice a series of buttons appear on the left side of this toolbar.

3. Select the Developer Mode (the wrench icon) button. A line appears through the wrench button, indicating
Developer Mode is active.
You can also activate Developer Mode through the Settings tile. From the Home screen, click Settings.
Verify General Options display, and then click Developer Mode.
Tip If you use the Classic Menu, you activate Developer Mode from the Main Menu. Either click the
Developer Mode button on the top toolbar or click Options > Developer Mode.

4. Navigate to Sales Order Entry.


Menu Path: Sales Management > Order Management > General Operations > Order Entry

5. If the Process Calling dialog box displays, click OK.

6. In the Select Customization window, select the Base Only check box and click OK.
Sales Order Entry appears.

7. From the Tools menu, select Customization.


The Customization Tools Dialog window displays.

8. Navigate to the One Time Ship To sheet.

9. From this window, click Tools > Toolbox.

10. Select the EpiButton option and click on an empty space on the form.

11. If the Select Layer Type window appears, select Customization and click OK. This window only displays
for partner organizations that can create verticalizations and other custom layer types. If your company is
not a partner organization, this window does not display.

12. Draw a new button on the form. In this example, you want to add a search that finds and selects a contact
and displays the phone number and email linked to this person.

13. Click on the Properties tab. In the Text property for the button, enter Contact Search.

Epicor ERP | 10.1 47


Custom Code Wizards Advanced Embedded Customization Course

Use the Event Wizard

You next must add a click event to the new button.

1. Navigate to the Wizards > Event Wizard sheet.

2. For the Control Type Filter, select EpiButton.

3. Select the specific Custom Control. In this example, you select epiButtonC1.

4. From the Available Control Events drop-down list, select Click.

5. Click the Right Arrow button.

6. Click the Update Selected Event Code button.

Add Text Fields

Next add the fields that will populate with search results.

1. Return to the Toolbox and select EpiTextBox.

2. Place the epiTextBox on the form.

3. From the Customization Tools Dialog, navigate to the Properties sheet.

4. Clear the value in the Text property.

5. In the EpiBinding property, link this text box to the OrderHed_Search01_c column you created.

6. For the Size value, enter 120, 20.

7. Now return to the Toolbox and select EpiLabel.

8. Place the EpiLabel on the form.

9. On the Properties sheet, change the EpiLabel's Text property to "First Name:".

10. Now click on the EpiText Box. On the Properties sheet, click in the EpiLabel property and select epiLabelC1
(the First Name label).
You can now move this text box and label around as a pair.

11. Repeat these steps to add three more text boxes and accompanying labels to the form.

Text Box and Label EpiBinding EpiLabel Size


Last Name: OrderHed.Search02_c epiLabelC2 120, 20
Phone: OrderHed.Search03_c epiLabelC3 120, 20
Email: OrderHed.Search04_c epiLabelC4 120, 20

12. After you have finished adding the text boxes and labels, you can clean up how they are placed on the form.
Press <Shift> and select each of your new text fields.

48 Epicor ERP | 10.1


Advanced Embedded Customization Course Custom Code Wizards

13. From the Customization Tools Dialog, select Format > Align > Lefts.
Your new text boxes and labels are now lined up together.

Launch the Simple Search Wizard

You now use the Simple Search Wizard to link the custom text fields to the search results.

1. In the Customization Tools Dialog window, select Tools > Wizards > Customization Wizards.
The Customization Code Wizard Dialog window displays.

2. From the list, select Simple Search and click Launch Wizard.
The Simple Search Wizard window displays.

3. Click the GetAdapters button.

4. Select the search adapter you want to bind to the search button. In this example, you select the
CustCntAdapter and click Next.

5. You have the option of adding the search to a drop-down list or a search dialog. For this example, you select
the SearchDialog option.
Note If you select the DropDown option, you need to select a custom EpiCombo drop-down list you
have added to the form. You then select the field from the search adapter to which the EpiCombo is
bound and then the field from the search adapter displayed within the EpiCombo.

6. You next indicate what data displays in each of your custom fields. From the Search Fields drop-down list,
select FirstName.

7. Now link this data to the dataView and field. In this example, you select the OrderHed dataView and the
Search01_c field from these drop-down lists.

8. Click Add. The First Name search field and its target display field appear in the wizard.

9. Repeat these steps to add three search fields and their target display fields.

Search Field Data View Field


LastName OrderHed Search02_c
PhoneNum OrderHed Search03_c
EmailAddress OrderHed Search04_c

10. Click Finish.

11. Now click Close to exit the Customization Code Wizard.

Finish the Customization

1. Navigate to the Script Editor and place the call to the search adapter within the code for the button click
event. Locate the private void epiButtonC1_Click(object sender, System.EventArgs
args) code phrase.

Epicor ERP | 10.1 49


Custom Code Wizards Advanced Embedded Customization Course

2. Under the // ** Place Event Handling Code Here ** comment enter:


SearchOnCustCntAdapterShowDialog();

3. Verify the syntax is correct. Click Tools > Test Code. If it is correct, the Output pane displays **Custom
Code Compiled Successfully.**

4. Click Save.
The Customization Save Dialog window displays.

5. In the Name and Description field, enter XXXContactSearch (where XXX are you initials) and click Save.

6. Exit the Customization Tools Dialog and Sales Order Entry.

Test the Customization

1. Relaunch Sales Order Entry.

2. From the Select Customization window, select XXXContactSearch (where XXX are your initials)

3. Click New. For the Customer field, enter Dalton.

4. Navigate to the One Time Ship To sheet.

5. Click on your new Contact Search button.

6. Find and select Jim Forrester and click OK.

The contact’s phone number and email address display in your custom fields.

50 Epicor ERP | 10.1


Advanced Embedded Customization Course Business Activity Queries and Dashboards

Business Activity Queries and Dashboards

You can create customizations that interact with dashboards and business activity queries (BAQs). These
customizations then display the specific data your users need within a customized program.
Business Activity Queries are queries that pull in custom views of data. You create and modify business activity
queries within the Business Activity Query Designer. Use this program to first select and join tables. You then
define what columns from the selected tables display in the results. Through this functionality, you can also create
calculated fields that run expressions against the query results to return unique values.
You can then directly add these queries to customizations through BAQ zones. A BAQ zone is an embedded
query you can add to a specific field on a customized form. When you activate a BAQ zone, it displays as a linked
tool tip window. The data that populates this window depends on both the business activity query and current
value, if any, within the linked field.
You can also create custom dashboards that display BAQ data. Dashboards are flexible, powerful tools that display
current information users need to more efficiently review crucial data and perform tasks. After you select the
BAQ for the dashboard, you then use the dashboard tools to create grid, chart, gauge, and other views based
on the information available for display through the selected BAQ.
Tip This section of the course describes how you embed BAQs and dashboards within your customizations.
For more information on how to create business activity queries and dashboards, enroll in the courses you
need or review the Epicor ICE Tools User Guide.

Workshop - Part Image BAQ Zone

In this workshop, create a customization for Part Maintenance. Add a BAQ zone to this customization that
populates with an image that matches the current part number. To complete this task, create a business activity
query that uses a calculated field.

Create Part Images


Before you create this BAQ zone, you need to have a graphic file library available that contains part illustrations
or photos.

1. On your local machine create a following folder:


C:\_BAQZones

2. Inside the InfoZones folder create the two following images. If you have a screen capture tool, you can take
a screen capture of these images (you may have created one of these images during a previous workshop):

1032FW.bmp

Epicor ERP | 10.1 51


Business Activity Queries and Dashboards Advanced Embedded Customization Course

1032KNUT.bmp
For the testing purposes, these files can also be other .bmp images available to you in your environment.

Create the BAQ

You need to first create a business activity query (BAQ) that pulls data from the Part table.

1. Be sure you shut off Developer Mode. Click the arrow at the bottom of the Epicor ERP window.
A toolbar displays. Notice a series of buttons appear on the left side of this toolbar.

2. Select the Developer Mode (the wrench icon) button. The line no longer appears through the wrench
button, indicating Developer Mode is turned off.
You can also deactivate Developer Mode through the Settings tile. From the Home screen, click Settings.
Verify General Options display, and then click Developer Mode. The check mark no longer displays next
to this option.
Tip If you use the Classic Menu, you deactivate Developer Mode from the Main Menu. Either click
the Developer Mode button on the top toolbar or click Options > Developer Mode.

3. Navigate to the Business Activity Query Designer.


Menu Path: Executive Analysis > Business Activity Management > Setup > Business Activity Query
Important This program is not available in Epicor Web Access.

4. Click New.

5. In the Query ID and Description fields, enter XXXPartImage (where XXX are your initials).

6. Select the Shared check box.

7. Navigate to the Query Builder > Phrase Build sheet.

8. In the Filtering field, enter part.

9. From the Filtering pane, double-click the Erp.Part table.


The table displays on the grid.

10. Navigate to the Display Fields > Column Select sheet.

11. Click the Alphabetize button ( with the A-Z icon) to display the columns in alphabetical order.

12. Expand the Part node.

52 Epicor ERP | 10.1


Advanced Embedded Customization Course Business Activity Queries and Dashboards

13. Select the PartNum field and click the Right Arrow to move the selected field to Display Column(s).
The Part_PartNum column now displays in the Display Column(s) grid.

You next need to create a calculated field.

Define Calculated Field

In order to display the part graphic files, you need to create a calculated field.

1. Click the Calculate button.


The Calculated Field Editor window displays.

2. Click New.

3. In the Field Name field, enter PartImage.

4. In the Data Type field, select nvarchar.

5. In the Format field, enter x(80).


This calculated field can now handle values up to 80 characters in length.

6. In the Label field, enter PartImage.


Note You store the image files on your local hard drive. Each of these .bmp files use the Part Number
value for their filenames. You need to create an expression that first goes out to this directory path
and then calculates the current Part Number value.

7. In the Editor section, enter the following:


'C:\_BAQZones\[LIKE:Part.PartNum].bmp'
For this expression, you use the LIKE Lookup Token (BAQ Markup syntax) to determine the name of the
.bmp graphic file. This means that the current value in the Part.PartNum field is used to determine the value
that will populate in the calculated field. If the expression finds an image filename that matches this value,
the BAQ zone displays this graphic file.
Note
In general, the Markup syntax looks as follows: [Token:Value].

Note The open and closing brackets "[]" indicate the constant is using the BAQ Markup Language.

The Token attribute within the brackets defines the type of replacement to perform, and the value can be
either:
• Like - For example you can use [Like:Customer.CustID] syntax to find the first data column of the
currently selected data view that has the matching Like value. Typically, use this markup when the BAQ
will be re-used on several UIApps where the Like value will be found.
• EpiBinding - For example, you can use [EpiBinding: OrderHed.CustomerCustID] syntax to find the
data value of the currently selected row of the data view and column described by the EpiBinding.
Typically, use this markup when the BAQ will be used on a specific UIApp where the EpiBinding is known.
• Current Value - This option is primarily used for InfoZone BAQs, where the InfoZone was added to a
UI control that is "unbound". As a result of being unbound, the data value is not accessible via either
of the previous two options. When you need to retrieve a value from an unbound control and use it for
an InfoZone BAQ criteria, use the [Current:Value] syntax.

Epicor ERP | 10.1 53


Business Activity Queries and Dashboards Advanced Embedded Customization Course

8. Click Save and exit the Calculated Field Editor window.

9. To finish your XXXPartImage query (Where XXX are your initials), click Save.

10. Exit Business Activity Query Designer.

Create the Customization


Now return to the Settings window and activate Developer Mode again.

1. Activate Developer Mode. Click the arrow at the bottom of the Epicor ERP window.
A toolbar displays. Notice a series of buttons appear on the left side of this toolbar.

2. Select the Developer Mode (the wrench icon) button. A line appears through the wrench button, indicating
Developer Mode is active.
You can also activate Developer Mode through the Settings tile. From the Home screen, click Settings.
Verify General Options display, and then click Developer Mode.
Tip If you use the Classic Menu, you activate Developer Mode from the Main Menu. Either click the
Developer Mode button on the top toolbar or click Options > Developer Mode.

3. Navigate to Part Maintenance.


Menu Path: Production Management > Job Management > Setup > Part

4. If the Process Calling dialog box displays, click OK.

5. In the Select Customization window, select the Base Only check box and click OK.

6. Click OK.
The Part Maintenance form displays.

7. From the Tools menu, select Customization.


The Customization Tools Dialog window displays.

8. From the Tools menu, select Wizards > Customization Wizards.


The Customization Code Wizard Dialog window displays.

9. Select the Modify Extended Properties wizard.

10. Click the Launch Wizard button.


The Extended Property Wizard displays.

11. In the DataView field, select Part.

12. In the DataField field, select PartNum.


This is the field to which you to link the BAQ zone.

13. In the Extended Property field, select ZoneBAQ.

14. In the Value field, select XXXPartImage (where XXX are your initials).
This is the BAQ you created that will be linked to the Part.PartNum field.

54 Epicor ERP | 10.1


Advanced Embedded Customization Course Business Activity Queries and Dashboards

15. Click Finish.

16. In the Customization Code Wizard Dialog, click Close.

17. In the Customization Tools Dialog, click Save.


The Customization Save Dialog displays.

18. In the Name and Description fields, enter XXX_BAQZone (where XXX are your initials).

19. Click Save.

20. Exit Customization Tools Dialog and exit Part Maintenance.

Test the BAQ Zone

1. Launch Part Maintenance again.

2. In the Select Customization window, select XXX_BAQZone (where XXX are your initials) customization.

3. Click OK.

4. In the Part field, enter 1032FW and press Tab.

5. Hold your mouse over the BAQ Zone.


The corresponding image from your graphic library displays within the zone.

6. In the Part field, enter 1032KNUT and press Tab.

7. Hold your mouse over the BAQ Zone; this zone is the Right Arrow icon added to the right side of the Part
field.
The corresponding image from your graphic library displays within the zone.

8. Close Part Maintenance.

Workshop - Work with Embedded Dashboards

You can use the Embedded Dashboard Panel wizard to add a dashboard to a new sheet. Leverage this wizard
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 Part Maintenance. You can test the new, embedded dashboard before you actually deploy it within the
Run Mode to ensure it accurately displays the records desired.
Most dashboards can be embedded though the Sheet Wizard; these include the dashboards delivered with the
Epicor ERP application as well as custom dashboards created by users. Note that to embed the dashboard, it must
have some data connection or relationship with the user interface.
When you embed a dashboard or when you need to determine the column to use for subscribing data, use the
Data Dictionary Viewer. This program can help you select the best columns for defining the subscription values.

Epicor ERP | 10.1 55


Business Activity Queries and Dashboards Advanced Embedded Customization Course

Menu Path: System Setup > System Maintenance > Data Dictionary Viewer

Add a New Sheet


Important The workshop assumes the Developer Mode is active and you are logged in with appropriate
permissions to generate customizations.

1. Close and launch Part Maintenance again.


Menu Path: Production Management > Job Management > Setup > Part

2. If the Process Calling dialog box displays, click OK.

3. In the Select Customization window, select the Base Only check box and click OK. This begins a new
customization with a clean form.
Part Maintenance launches.

4. From the Tools menu, select Customization. If you are asked to clear this form, click OK.
The Customization Tools Dialog window displays.

5. In the Customization Tools Dialog window, navigate to the Wizards > Sheet Wizard sheet.

6. Click the New Custom Sheet button.

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

8. In the Name field, enter PartStatus.

9. Now in the Text and Tab Text fields, enter Part Status (add the space between the words).

10. Click the Add Dashboard button.


The Embedded Dashboard Panel Wizard displays.

11. Verify the Dashboard Panel option is selected.


This causes the embedded dashboard to bring the dashboard definition directly from the dataset during run
time.
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.

12. Click the Dashboard ID button to search for and select the PartOnHandStatus dashboard.

13. Click Next.

56 Epicor ERP | 10.1


Advanced Embedded Customization Course Business Activity Queries and Dashboards

Define Publish/Subscribe Options

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 user interface form based on the options defined in the
Step 2 of 3 window within the Embedded Dashboard Panel Wizard.

1. From the radio button options, select Subscribe to UI data (include Retrieve button). Select this option
if the dashboard should be empty when the user interface launches. Users then click the Retrieve button
to display data linked to the record selected on the customized program.
Other options:
• 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.
• Publish data to the UI - Select this option when you will use the dashboard as a search for the user
interface. After you select a record on the embedded dashboard, the other sheets on the UI populate
with data from the record selected on the dashboard.
• Neither Subscribe nor Publish - Use this option to have the dashboard display the data independently
from the current program.

2. Click Next.
The Subscribe to UI data (include Retrieve button) option requires you define the dashboard columns to
which the user interface will subscribe.

3. From the DataView listing, select Part.

4. Now from the DataColumn listing, select PartNum.

5. Click the Add Subscribe Column button.

6. Click Finish to return to the Customization Tools Dialog window.


Note that PartStatusOnHandStatus now displays within the Add Dashboard field.

7. Click the Right Arrow to move the PartStatus embedded dashboard into the Custom Sheets list.
Important The dashboard does not embed until it displays under the Custom Sheets list.

8. Click Save.
The Customization Save Dialog window displays.

9. In the Name field, enter XXXDashboard (where XXX are your initials).

10. In the Description field, enter XXX Dashboard (where XXX are your initials) and click Save.

11. Close the Customization Tools Dialog window.

Test the Dashboard

1. Launch Part Maintenance again.

Epicor ERP | 10.1 57


Business Activity Queries and Dashboards Advanced Embedded Customization Course

2. From the Select Customization window, highlight the XXXDashboard customization (where XXX are your
initials) and click OK.
Part Maintenance displays.

3. Navigate to the Part > Detail sheet.

4. In the Part field, enter 1032X100 and press <Tab>.

5. Navigate to the PartStatus sheet to display the Part On Hand Status dashboard.

6. On the Parts tab, click Retrieve.

7. Now click through the sheets available on the Part On Hand Status Tracker.
Notice records for the 1032X100 part records display on the tracker sheets.

8. Exit Part Maintenance.

Workshop - Add a Dashboard to the MES Menu

In the following workshop, you will add a dashboard to the Manufacturing Execution System (MES) menu. This
menu is an alternate interface users typically use in their manufacturing center.

Create a Simple Dashboard


You start by creating a new dashboard.

1. Before you launch the Dashboard, be sure you shut off Developer Mode. Click the arrow at the bottom of
the Epicor ERP window.
A toolbar displays. Notice a series of buttons appear on the left side of this toolbar.

2. Select the Developer Mode (the wrench icon) button. The line no longer appears through the wrench
button, indicating Developer Mode is turned off.
You can also deactivate Developer Mode through the Settings tile. From the Home screen, click Settings.
Verify General Options display, and then click Developer Mode. The check mark no longer displays next
to this option.
Tip If you use the Classic Menu, you deactivate Developer Mode from the Main Menu. Either click
the Developer Mode button on the top toolbar or click Options > Developer Mode.

3. Once you clear Developer Mode, navigate to the Dashboard.


Menu Path: Executive Analysis > Business Activity Management > General Operations > Dashboard
Important This program is not available in Epicor Web Access.

4. If the Process Calling dialog box displays, click OK.

5. You may need to activate Dashboard Developer Mode as well. To do this, click Tools>Developer.
The New menu now displays; you use the options on this menu to create a dashboard.

6. Click the New menu and select New Dashboard.

58 Epicor ERP | 10.1


Advanced Embedded Customization Course Business Activity Queries and Dashboards

7. In the Definition ID field, enter Customer-XXX (where XXX are your initials).

8. For the Caption and the Description fields, enter MES Customer Dashboard.

9. Click New and select New Query.


The Dashboard Query Properties window displays.

10. In the Query ID field, enter zcustomer01 and press Tab.


Tip If a query begins with a "z" prefix, the BAQ is a default system query. You cannot change these
queries, but you can use them to display data on custom dashboards. Within the BAQ Designer, you
can also copy system queries and then modify the duplicated query as you need.

11. In the Dashboard Query Properties window, click OK.

12. Navigate to the Dashboard sheet.

13. On the Standard toolbar, click Refresh and view the results.
The dashboard is now ready to be deployed to the server.

Deploy the Dashboard

1. From the Tools menu, select Deploy Dashboard.


The Deploy Dashboard window displays.

2. Select the Deploy Smart Client Application check box and click Deploy.
A field at the bottom of this window documents the dashboard build process.

3. Once the process is finished, click OK.

4. Click Save and Close the dashboard.

Create a New Menu Option

1. Navigate to Menu Maintenance.


Menu Path: System Setup > Security Maintenance > Menu Maintenance
Important This program is not available in Epicor Web Access.

2. In the tree view, expand Main Menu > Executive Analysis > Trackers.

3. Highlight the Trackers node.

4. Select New > New Menu.

5. In the Menu ID field, enter MES-XXX (where XXX are your initials).
You will use the Menu ID later when you enter custom code on the MES Menu. Be sure to write down this
value so you can find it when you enter this code.

6. In the Name field, enter Customer MES Dashboard.

Epicor ERP | 10.1 59


Business Activity Queries and Dashboards Advanced Embedded Customization Course

7. In the Order Sequence field, enter 1. This should place your new menu item at the top of this Main Menu
node.
Tip This field defines the placement of the item within the menu. If the number you entered is already
used, select a different number.

8. From the Program Type drop-down list, select Dashboard-Assembly.

9. From the Dashboard drop-down list, select MES Customer Dashboard you created.

10. Click Save.

11. If the Security Settings window displays, click OK.

12. Close Menu Maintenance.

Refresh the Session

You have to refresh the current session to see changes made to the menu.

1. Return to the Home window and select the Settings button.

2. Select Change User.


The Log On window displays.

3. Log into the Epicor application using the same credentials: epicor/epicor.

4. From the Home window, click the Menu button.

5. On the Menu, navigate to Executive Analysis > Trackers.


Verify the Customer MES Dashboard displays as a menu item.

6. Double-click the Customer MES Dashboard.

7. Click Refresh to verify it populates with data.

8. Close the dashboard.

Create an MES Developer Icon

You next need to create an alternate Epicor icon. You then use this icon to launch the Epicor application in both
MES and Developer mode.

1. Go to your desktop.

2. Right-click the Epicor icon; from the context menu, select Copy.

3. Now right-click an empty area on your desktop; from the context menu, select Paste.

4. Right-click on the copied icon; from the context menu, select Rename.

5. For the icon name, use MES Developer.

60 Epicor ERP | 10.1


Advanced Embedded Customization Course Business Activity Queries and Dashboards

6. Right-click the icon and select Properties.

7. In the Target field, at the end of the path, enter -MESC.


Example C:\Epicor\ERP10\Client\Epicor.exe -MESC

8. Click Apply and then OK.

You have now created a separate Epicor icon that will launch the MES interface in Developer mode. If you just
needed to launch MES in run mode, you would enter -MES instead.

Customize a Blank Button


Launch the MES Developer icon.
For the User name and Password, use manager/manager.

1. In the Select Customization window, click OK.


The MES Menu displays. If the Selection Customization window appears again, click OK.

2. Right-click anywhere in the form and select Customization.


The Customization Tools Dialog window displays.

3. On the MES Menu, navigate to the Supervisor sheet.

4. Select the blank button under Inspection Processing.

5. In the Customization Tools Dialog, in the Tree view, notice button10 becomes highlighted.

6. Navigate to the Properties sheet.

7. In the Epibinding field, delete the default binding value.

8. Locate Misc properties group and then the EpiGuid field. Copy and paste this identifier value in a text editor
like Notepad.
Example 799a9b4c-7f77-4710-8468-603516ea244b

9. In the Text field at the bottom, enter MES-XXX (where XXX are your initials).

Use the Form Event Wizard

1. In the Customization Tools Dialog, navigate to the Wizards > Form Event Wizard sheet.

2. In the Select Event Type field, select Load.

3. Click the Right Arrow button.

4. In the View / Edit Handling Code box, enter the following code after the // Add Event Handler Code
statement.
{
// Add Event Handler Code

Epicor ERP | 10.1 61


Business Activity Queries and Dashboards Advanced Embedded Customization Course

btnDash.ReadOnly = false;
}

5. Click the Update Selected Event Code button.

6. Navigate to the Script Editor sheet.

7. Now at the end of the code, just below the btnDash.ReadOnly = false; statement, enter the following
code.
private void btnDash_Click(object sender, System.EventArgs args)
{
ProcessCaller.LaunchForm(this.oTrans, "MES-XXX");

}
The "MES-XXX" value refers to the Menu ID you previously entered in Menu Maintenance. Be sure to
substitute the "XXX" with your initials. This piece of code indicates the system should launch the form
defined by this Menu ID.

8. At the top of the script, right after the '// Add Custom Module Level Variables Here **, enter the
following code.
EpiButton btnDash;
public void InitializeCustomCode()
{
btnDash =
(EpiButton)csm.GetNativeControlReference("799a9b4c-7f77-4710-8468-603516ea244b");
}
Be sure to substitute the EpiGuid reference you previously copied. This identifies the button on the MES
interface you are customizing.

9. Scroll down the Script Editor until you locate the // End Wizard Added Custom Method Calls
comment. Enter the following code just below this comment:
this.btnDash.Click += new System.EventHandler(this.btnDash_Click);

10. Next scroll down the Script Editor until you locate the // End Custom Code Disposal comment. Enter
the following code just below this comment:
this.btnDash.Click -= new System.EventHandler(this.btnDash_Click);

11. From the Tools menu, select Test Code.


The ** Custom Code Compiled Successfully. ** message should display. If you receive errors, review the
example script at the bottom of this topic. Correct your code syntax and test the code again.

12. Click Save.


The Customization Save Dialog displays.

13. In the Name and Description fields, enter MES-XXX (where XXX are your initials).

14. Click Save.

15. Exit the Customization Tools Dialog window.

16. Exit MES.

62 Epicor ERP | 10.1


Advanced Embedded Customization Course Business Activity Queries and Dashboards

Note that when you are finished, the code for your customization should resemble the following:
// **************************************************
// Custom code for MESMenu
// Created: 2/19/2017 8:42:46 AM
// **************************************************
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;

public class Script


{
// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Le
vel Variables' Comments! **
// Begin Wizard Added Module Level Variables **

// End Wizard Added Module Level Variables **

// Add Custom Module Level Variables Here **

EpiButton btnDash;

public void InitializeCustomCode()


{
btnDash = (EpiButton)csm.GetNativeControlReference("799a9b4c-7f77-4710-8468-
603516ea244b");

// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable


Initialization' lines **
// Begin Wizard Added Variable Initialization

// End Wizard Added Variable Initialization

// Begin Wizard Added Custom Method Calls

// End Wizard Added Custom Method Calls


this.btnDash.Click += new System.EventHandler(this.btnDash_Click);
}

public void DestroyCustomCode()


{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object D
isposal' lines **
// Begin Wizard Added Object Disposal

// End Wizard Added Object Disposal

// Begin Custom Code Disposal

// End Custom Code Disposal


this.btnDash.Click -= new System.EventHandler(this.btnDash_Click);
}

private void MESMenu_Load(object sender, EventArgs args)


{
// Add Event Handler Code

Epicor ERP | 10.1 63


Business Activity Queries and Dashboards Advanced Embedded Customization Course

btnDash.ReadOnly = false;
}

private void btnDash_Click(object sender, System.EventArgs args)


{
ProcessCaller.LaunchForm(this.oTrans, "MES-MSJ");

}
}

Test the Customization


Launch the MES Developer icon.
For the User name and Password, use manager/manager.

1. On the Select Customization window, select MES-XXX (where XXX are your initials) customization.

2. Click OK.
The MES Menu displays. If the Selection Customization window displays again, click OK to close it.

3. In the Employee ID field, enter 105 and press <Tab>.


You are now logged in as Charles L. Johnson. He is a user with supervisor rights on the MES menu.

4. Navigate to the Supervisor sheet.

5. Click the MES-XXX (where XXX are your initials) button.

6. In the Process Calling window, click OK.

7. In the Select Customization window, click OK.


The MES Customer Dashboard displays.

8. Click Refresh to verify the dashboard works properly.

9. Exit the dashboard.

10. Exit MES Menu.

64 Epicor ERP | 10.1


Advanced Embedded Customization Course Environment Information

Environment Information

This section of the course describes some additional information about how you customize the interface.

®
Modify Infragistics Components

To modify aspects of the form menu, access the Infragistics control properties that form the structural components
of the user interface.
The code that displays below demonstrates the method you use to modify the Infragistics components that make
up the UI structure or frames. The code that displays is written for ABC Code Maintenance; the general principles
can be extrapolated to nearly every 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 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 items are not exposed in the system architecture and are not accessible through the Object
Explorer. The C# code example below is strictly for use with the sometimes troublesome Delete icon:
private void AbcCodeForm_Load(object sender, EventArgs args)
{
// Add Event Handler Code
try
{
if(baseToolbarsManager.Tools.Exists("DeleteTool"))
{
baseToolbarsManager.Tools["DeleteTool"].SharedProps.Visible
=false;
}
}
catch(Exception ex)
{
ExceptionBox.Show(ex);
}
}

Debugging in Visual Studio


® ®
If you have Microsoft Visual Studio 2010, 2012, or 2013 you can debug (step through code as it executes)
your customization code. Debugging helps you test whether your code works correctly and resolve errors.
To use this functionality, install a version of Microsoft Visual Studio 2010 or later on the computer where you
run the Epicor client. You can install nearly every version of Microsoft Visual Studio except the Express version.
You should also have C# installed in Visual Studio, as you can then locate and resolve bugs in the custom code.

Epicor ERP | 10.1 65


Environment Information Advanced Embedded Customization Course

Non-Customizable Forms

Be aware that some programs, or forms, within the Epicor ERP 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.
You are 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.

66 Epicor ERP | 10.1


Advanced Embedded Customization Course Customization/Personalization Maintenance

Customization/Personalization Maintenance

Customization/Personalization Maintenance is an important tool for managing customizations and personalizations.


Its primary feature is its verification functionality which you use to detect problems.
Customization/Personalization Maintenance is especially useful when you upgrade the Epicor ERP application to
a new version, as it can help you make customized and personalized programs compatible with the current
version.
Customization/Personalization Maintenance has additional functionality for importing and exporting your
customizations and personalizations, so you can make these programs available throughout your organization.
You can also delete a 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.
Customization/Personalization Maintenance features:
• Review the details on each customization or personalization, including the Product ID, Version, LastUpdated
By, Form Name, and Parent Layer.
• Delete obsolete customization files and 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 from one location and import from another location.
• Test customizations and personalizations. This verification tool can review the custom fields and code within
a selected customization or personalization or a group of customizations and personalizations. It then informs
you whether the customizations or personalizations are valid.
• Use Run Mode and Developer Mode Access to launch a customization or personalization. You can use these
functions to discover why a selected personalization or customization does not work properly.
• Set a Verification Warning for users who attempt to launch an incompatible customization or personalization.
An error message displays that prevents the user from launching the program. You can then use
Customization/Personalization Maintenance to upgrade the program.
System Administrators with Security Manager rights can use this program to modify and delete customizations
and personalizations. For System Administrators without these rights, this program displays in a Read-Only
format. For more information on security, review the Security topics in the application help.

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.

Export a Customization

1. Before you begin this workshop, shut off Developer Mode. Click the Home button and the Settings tile;
select the Developer Mode option.

2. Navigate to Customization/Personalization Maintenance.


Menu Path: System Management > Upgrade/Mass Regeneration > Customization Maintenance

Epicor ERP | 10.1 67


Customization/Personalization Maintenance Advanced Embedded Customization Course

Important This program is not available in Epicor Web Access.

3. Navigate to the Detail sheet and click Name.

4. Browse for and select the XXXContactSearch (where XXX are your initials) customization created earlier.
Click OK.
Information about this customization displays on the Detail sheet.

5. From the Actions menu, select Export Customization.


The Export Customization window displays.

6. In the New Name field, enter XXXContactSearchExport (no spaces and where XXX are your initials).

7. Click Export Filename and browse to your Desktop.

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

9. In the Export Customization window, click Export.


The exported file is saved to your desktop.

Import a Customization File


To import a customization, normally you would navigate to another company and then launch
Customization/Personalization Maintenance. You would then do the following steps to import the customization
into the current company. However for the purposes of this workshop, you stay in the current company.

1. On the Standard toolbar, click Clear to clear Customization/Personalization Maintenance.

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 to your Desktop.

5. Select XXXExport (where XXX are your initials) and click Open.

6. In the New Name field, enter MyXXXContactSearch (no spaces and where XXX are your initials).

7. If you want to make this customization available to all companies in your organization, you would select
the All Companies check box. However for this workshop, do not select this check box.

8. Click OK.

9. The Customization Maintenance dialog window now indicates that the new customization was imported
successfully. Click OK.

Information about the imported customization now displays in Customization/Personalization Maintenance.

68 Epicor ERP | 10.1


Advanced Embedded Customization Course Customization/Personalization Maintenance

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 has two options for verifying customizations. The Verify Customization
option checks the code in the current customization to find errors and potential problems with controls
referenced by the form. The Verify All option runs this validation against selected customizations.
Verify All can be a long process, so only run this when you have enough time to validate multiple
customizations.

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 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. Next you want to delete this customization. In the tree view, verify your customization MyXXXContactSearch
(where XXX are your initials) is selected.

7. On the Standard toolbar, click Delete.

8. To the Delete this record? message, click Yes.


The customization is removed.

9. Exit Customization/Personalization Maintenance.

Epicor ERP | 10.1 69


Conclusion Advanced Embedded Customization Course

Conclusion

Congratulations! You have completed the Advanced Embedded Customization course.

70 Epicor ERP | 10.1


Additional information is available at the Education and
Documentation areas of the EPICweb Customer Portal. To access
this site, you need a Site ID and an EPICweb account. To create an
account, go to http://support.epicor.com.

You might also like