Advanced Business Process Management

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 89

Epicor ERP

Advanced Business Process


Management Course
10.2.600
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 2020.
All rights reserved. Not for distribution or republication. Information in this document is subject to Epicor license
agreement(s).

ED879905
90521-10-9221-5841001
10.2.600
Revision: July 06, 2020 4:22 a.m.
Total pages: 89
course.ditaval
Advanced Business Process Management Course Contents

Contents
Advanced Business Process Management Course................................................................6
Before You Begin....................................................................................................................7
Audience.........................................................................................................................................................7
Prerequisites....................................................................................................................................................7
Environment Setup..........................................................................................................................................7
Workshop Constraints..............................................................................................................................9
BPM User Rights....................................................................................................................10
BPM and Service Oriented Architecture..............................................................................11
How BPM Works...................................................................................................................12
Standard Execution Flow................................................................................................................................12
Using Business Process Management.............................................................................................................13
Use BPM to Send Email........................................................................................................15
Synchronous vs Asynchronous Execution........................................................................................................15
Design Email Template...................................................................................................................................15
Execution Rule...............................................................................................................................................16
Workshop - Send an Email.............................................................................................................................16
Add a Post-Processing Directive..............................................................................................................16
Use Send Email Action............................................................................................................................17
Test the BPM..........................................................................................................................................18
Change the Action.................................................................................................................................18
Test the BPM..........................................................................................................................................19
Disable Directive.....................................................................................................................................19
Default Data To Updatable BAQ Records...........................................................................21
Workshop - Populate Data in Updatable Dashboard.......................................................................................21
Publish Dashboard Data..........................................................................................................................21
Get the Updatable BAQ Methods...........................................................................................................22
New Post-Processing Directive.................................................................................................................23
Build BPM Workflow...............................................................................................................................24
Test Directive..........................................................................................................................................25
Disable Directive.....................................................................................................................................26
Set Text Properties...............................................................................................................28
Workshop - Set Text Properties......................................................................................................................28
Create New Method Directive.................................................................................................................28
Build BPM Workflow...............................................................................................................................29
Test the Directive....................................................................................................................................30
Disable the Directive...............................................................................................................................30
BPM Data Form Designer.....................................................................................................31
Workshop - Create a Form for User Input.......................................................................................................31
Create a BPM Data Form........................................................................................................................31
Locate the GetNewUserFile Method........................................................................................................32

Epicor ERP | 10.2.600 3


Contents Advanced Business Process Management Course

Add a Pre-Processing Directive................................................................................................................33


Add a Post-Processing Directive..............................................................................................................34
Create Test Message...............................................................................................................................34
Enable and Save the Directive.................................................................................................................35
Test the Method Directive.......................................................................................................................35
Build User ID Expression..........................................................................................................................35
Build Another Expressions.......................................................................................................................36
Save the Directive...................................................................................................................................37
Test the Method Directive.......................................................................................................................37
Disable Directives....................................................................................................................................38
Data Directives......................................................................................................................39
Workshop - Prevent Entering Same Information Using BPM Code..................................................................39
Locate the OrderHed Table.....................................................................................................................39
Add In-Transaction Directive...................................................................................................................40
Test Data Directive..................................................................................................................................41
Disable Directive.....................................................................................................................................42
Business Object Method Call...............................................................................................43
Workshop - Use Fill Table By Query and Invoke BO Method............................................................................43
Create New Method Directive.................................................................................................................43
Create Workflow Skeleton......................................................................................................................44
Configure Condition...............................................................................................................................45
Configure Invoke BO Method Action......................................................................................................45
Design BPM Query..................................................................................................................................47
Select Target Table.................................................................................................................................49
Configure Table Mappings......................................................................................................................49
Modify Customer Record........................................................................................................................51
Test the Directive....................................................................................................................................51
Disable Directives....................................................................................................................................52
Customization and BPM.......................................................................................................53
Update Table By Query..................................................................................................................................53
Workshop - Populate Additional Fields from a Related Table..........................................................................53
Customize Sales Order Entry...................................................................................................................54
Review Part Master Data.........................................................................................................................56
Add a Pre-Processing Directive................................................................................................................57
Add a Post-Processing Directive..............................................................................................................58
Create Test Message...............................................................................................................................59
Test the Method Directive.......................................................................................................................59
Add an Action........................................................................................................................................60
Configure Table Mapping.......................................................................................................................60
Extend the Condition..............................................................................................................................61
Complete the Workflow.........................................................................................................................62
Test the Method Directive.......................................................................................................................63
Using External Methods.......................................................................................................64
Workshop - Create External Method..............................................................................................................64

4 Epicor ERP | 10.2.600


Advanced Business Process Management Course Contents

Access Method Arguments.....................................................................................................................64


Use Programming Interface Generator Form...........................................................................................65
Define External Method Logic.................................................................................................................66
Call External Method..............................................................................................................................68
Test the Method.....................................................................................................................................69
Disable Directive.....................................................................................................................................71
Managing Method Directives..............................................................................................72
Workshop - Export Directives.........................................................................................................................73
Workshop - Import Directives.........................................................................................................................73
Calling Epicor Functions.......................................................................................................75
Workshop - Use Invoke Function Widget in BPM Workflow............................................................................75
Create a Library......................................................................................................................................75
Create a Function...................................................................................................................................76
Define Parameters...........................................................................................................................77
Design Workflow.............................................................................................................................77
Create a Method Directive......................................................................................................................79
Design Workflow.............................................................................................................................79
Test the Directive....................................................................................................................................79
Publish the Library..................................................................................................................................80
Debugging Using Visual Studio...........................................................................................81
Prerequisites..................................................................................................................................................81
Debug BPM Directive.....................................................................................................................................82
Conclusion.............................................................................................................................88

Epicor ERP | 10.2.600 5


Advanced Business Process Management Course Advanced Business Process Management Course

Advanced Business Process Management Course

This course focuses on advanced techniques users can leverage within Business Process Management (BPM).
Epicor BPM identifies and improves processes to make customers business more efficient, more disciplined, and
better able to adapt to change. BPM technology enables organizations to automate and streamline business
processes for continuous improvement.
The BPM functionality is available on nearly every business process in the system and it activates using the Epicor
Server. Whether the transaction originates from the Epicor Client or Epicor Web Services, the BPM results are
the same. For this reason, Business Process Management is often the best toolset for system modifications. For
example, making a field mandatory is easier to set up and maintain through a BPM method than a client
customization.
The course first describes benefits using Business Process Management in a Service Oriented Architecture
environment, followed by the general overview of BPM functionality. The course then follows by step-by-step
case studies. Each case study explores a different aspect of the BPM functionality you can make use of in a real
life environment.
Upon successful completion of this course, you will be able to:
• Understand benefits of a Service-Oriented Architecture.
• Get to know main principles of using BPM.
• Create an email template and use BPM to send notifications.
• Use the directive to default data in a newly added records.
• Control text properties through a BPM directive.
• Create BPM forms invoked by method directives.
• Use Data Directives to initiate actions when updates to specific tables occur.
• Use the Invoke BO Method action to call Business Object (BO) methods from within a directive.
• Retrieve additional information outside the current dataset to populate custom fields.
• Learn how to create and call Custom External Methods.
• Debug execution of custom code directives.
• Manage method directives.

6 Epicor ERP | 10.2.600


Advanced Business Process Management 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

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.
• 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.
• Introduction to the Dashboard Course - This course provides an introduction to the dashboard - a
personalized information and a command center.
• Business Process Management Course - This course focuses on the Business Process Management (BPM).
Using the BPM functionality, you can modify the flow of business processes through the Epicor ERP application.
This allows individual companies to tailor the business flow to their specific requirements.

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.

Epicor ERP | 10.2.600 7


Before You Begin Advanced Business Process Management Course

• The Epicor demonstration database is at the same version as the Epicor application. The
demonstration database is installed from the Epicor Administration Console using the "Add Demo
Database" command under Database Server. See Epicor ERP installation guides for details. If you are an
Epicor Cloud ERP customer (and have licensed embedded education), the demonstration database is
installed for you.
• 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. If you are an Epicor Cloud ERP
customer see section below.

2. Log in to the training environment using the credentials epicor/epicor.


If you are asked to log into your training environment with another User ID, for example, 'nancy' or 'bhoward',
on the initial logon, a message appears to inform you the password has expired. Perform the following steps
to set a new password:

1. To the Password Expired message, click Yes.

2. In the Current password field, enter the User ID of the user you are asked to log in as, for example,
'nancy'.

3. In the New password field, enter a new password, for example 'Train123'.
Important In Epicor ERP Cloud environment, the password must not contain user ID, must be
longer than 7 characters and include at least one uppercase letter.

4. In the Confirm new password field, re-enter the same password.

5. Click OK. The Change Password window closes and you are logged on with the new user ID.
Note Record the new password. This is important as this will be the password everyone uses
when they log on with this User ID, until the database is refreshed.

3. From the Main menu, select the company Epicor Education (EPIC06).

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

Epicor Cloud ERP Specific Information


Note If you are an Epicor Cloud ERP customer, then note the following about your Epicor-hosted education
company. All logins referenced in the course (such as manager, or epicor) should be changed to be the
<site ID>-. For example, if your site ID is 98315, then wherever you are instructed to use the login epicor,
instead use 98315-epicor. The password is 'Train18!'.

Note To refresh your Epicor training data, enter a support ticket in EpicCare and include your site ID.

8 Epicor ERP | 10.2.600


Advanced Business Process Management Course Before You Begin

Workshop Constraints

For this course to work the best within this training environment, be sure to accurately follow all the steps included
in each workshop. After you have successfully completed a BPM workshop, be sure you either disable or delete
the BPM method. Disabling or removing BPM methods ensures the default training environment is always available.
Note Restoring (refreshing) the demonstration database does not automatically remove existing BPM
directives. All BPM directives must be manually removed or disabled.

• Workshop - Use BPM to Send Email


To complete this workshop, on the Company Maintenance > Email and Reporting sheet, you must enter
your network's Server Mail Transport Protocol (SMTP) Server and the SMTP Port number.
This information varies from company to company. Contact your IT Specialist to obtain this information before
you begin this course. You may note this information here.
SMTP Email Server: __________________________________
SMTP Port: _____________________
• Advanced BPM User rights are not available to Epicor ERP Cloud users. Therefore, Epicor ERP Cloud users
must skip the following workshops:
• Workshop - Prevent Entering Same Information Using BPM Code
• Workshop - Create External Method
Also, to complete this workshop, Microsoft® Visual Studio® 2010 or later must be installed and operational
in your environment.

• Workshop - Populate Data in Updatable Dashboard


Creation and usage of updatable BAQs is only allowed to users having BAQ Advanced User rights granted
in User Account Maintenance.

For more information, contact your system administrator.

Epicor ERP | 10.2.600 9


BPM User Rights Advanced Business Process Management Course

BPM User Rights

Two levels of Business Process Management (BPM) functionality are available - a base level and an advanced
level.
Any users who have menu access to BPM can use the base level BPM functionality to create Method and Data
Directives. The BPM standard interface uses design elements and their related method parameters, variables and
action items calling the ERP business objects within the context of the tenancy of the user. Most common business
requirements for reading and writing data can be accomplished by using the built in interface.
The base user is restricted to using elements which do not have a freeform C# code editor, and from using
freeform code in the base processing tab (even if called from an updatable BAQ).
Users with Advanced BPM rights can access the additional design elements which enable freeform C# code.
You give specific user rights to the advanced BPM features through User Account Maintenance. These rights
are assigned on the Options sheet. The entire BPM toolset includes the following:
• Callers
• Execute Custom Code
• Invoke External Method
• Call SC workflow (Service Connect)

• Others
• Notify Collaborate (Used with Epicor Collaborate)

• Setters
• Set By Query

• Base processing for creating completely new business logic which is used instead of the business logic developed
by Epicor. Users are encouraged to work with Epicor CSG (Custom Programming Group) or an authorized
partner organization before replacing a base method.
• Create Programming environment using the Programming Interface Generator form.
• Create any kind of Expression constructions for use with BPM/BAQ sub-systems, including complex ones.
Important Advanced BPM User rights are not available to Epicor Cloud ERP - Multi Tenant Users,
as freeform C# code may introduce a security risk for access of data outside of the tenancy. Use of C# in
BPMs is regulated, and requires advanced approval from Cloud Operations to ensure conformity with our
security and operational standards. Most common business requirements for reading and writing data
within the tenancy restrictions can be accomplished by using the built in interface. To request a feature
requiring BPM Advanced User rights, contact Epicor Professional Services or an authorized Epicor partner.
You can also submit a request to CloudCodeReview@epicor.com for deployment.

10 Epicor ERP | 10.2.600


Advanced Business Process Management Course BPM and Service Oriented Architecture

BPM and Service Oriented Architecture

A service-oriented approach ensures the reduction of complexities in terms of how business systems are built
and operated. In an SOA, business logic is software processes broken down into a series of loosely coupled
granular "business services" which are then made available and discoverable on a network.
Each service provides functionality you can adapt to the needs of the enterprise, but also hides the underlying
implementation details. By exposing business processes, SOA provides the ability to streamline those same
processes, which in turn promotes agile change management. In a SOA, because business processes are broken
down into smaller functions you can easily access and manipulate, it becomes that much easier to have your
business system represent your business rules.
Epicor True SOA™ considers both server business logic and client business logic as "business services".

Most business processes, no matter how much they lend themselves to automation, need to pause and proceed
after some condition is met or a user intervenes. One of the benefits of BPM is its integration with various
applications to provide a lean, inclusive business process. For example, in conjunction with Epicor Service Connect,
BPM provides real-time, event-driven workflow orchestrations, process automation, and application integration
without the need for programming. BPM delivers a flexible tool in support of continuous performance initiatives
like Lean and Six Sigma, by making software more agile to build custom business rules and then manage those
rules at a business level.
The main reason you should use BPM in a SOA environment is that you can customize your business processes
without modifying source code. Instead of customizing the system to match your business requirements, you
configure the system to match them.

Epicor ERP | 10.2.600 11


How BPM Works Advanced Business Process Management Course

How BPM Works

This topic lists the key features of Business Process Management.


The key features of Business Process Management include the following:
• Designed to explicitly understand and manage business processes within the Epicor application.
• Embedded directly in the application.
• BPM workflow utilizes interconnected workflow items, representing the flow of BPM execution.
• Each BPM item is represented by an icon in the diagram.
• Contains advanced BPM features like .NET scripting and calls to Epicor Service Connect.
• Maintains full audit tracking of all interactions.
• BPM reacts to Events, interprets Conditions assigned to events and takes Actions based on conditions.

Standard Execution Flow

This topic outlines the standard communication model between client and server, without a BPM intervention.

12 Epicor ERP | 10.2.600


Advanced Business Process Management Course How BPM Works

The standard client-server data exchange process includes the following:


• A user performs an action in a program.
• The program calls a business object method to carry out the action.
• The Epicor program's code performs its function and related database transactions run.
• Data is returned to the program according to the actions run by the Epicor program.

Using Business Process Management

BPM directives work by intercepting calls to the application server logic. They are embedded into server logic and
get invoked by method calls. You can validate, manipulate, or create workflows based on the data passed through
the application. Because BPM methods are server side customizations, you can change business logic without
modifying the source code.

The key elements of using BPM directives within the application include the following:
• A user performs an action in a program.
• The program calls a business object method to carry out the action.
• Before the business object executes its program code, Pre-Processing directives are executed.

Epicor ERP | 10.2.600 13


How BPM Works Advanced Business Process Management Course

Note If at least one non-empty Base Processing directive is in effect, the Base Processing directive will
run instead of the Epicor program code.

Important Epicor strongly recommends you do not create Base Processing directives. If you change a
base method incorrectly, you can harm the normal function of the application. This option is mainly
included for partners, consultants, and power users who need to directly modify the method for major
business modifications. Work with an Epicor consultant before you create a base processing method
directive.

• After the Pre-Processing directive, the Epicor program code performs its function, or Base directives are
executed.
• When data transaction is about to be applied to the database, In-Transaction directives are executed.
• After the Epicor program code or Base directive is run, Post-Processing directives are executed.
• Standard data directives are executed with accumulated transaction database changes passed to them.
• Data is returned to the program according to the actions run by the directives and Epicor program.

14 Epicor ERP | 10.2.600


Advanced Business Process Management Course Use BPM to Send Email

Use BPM to Send Email

You can use Business Process Management to send an email based on a business process.
Example You would like to assign specific values to suppliers. When a user creates or updates a supplier
record but does not assign a supplier group to it, you want the Epicor application to automatically assign
the ISO 9000 Certified supplier group to the record.
Then you can use BPM to generate an email informing the recipient the default supplier group was assigned
to the supplier record.

To create a directive to send an email, use the Send Email BPM workflow action and specify the following
statement:
Send email asynchronously based on the designed template with rule
Note Since the email is sent after the record successfully updates, sending an email is typically a post
process on an Update method.

Synchronous vs Asynchronous Execution

You can send an email either synchronously or asynchronously. This indicates how the Epicor application handles
email generated by this action.
Available options:
• Synchronously - The email is sent when the action executes.
• Asynchronously - Asynchronous execution means the action is processed automatically by the BPM system
tasks running behind the scenes. The system task runner performs calls to the server every 20 seconds and
processes all asynchronous actions in the queue. Users cannot configure this system task.

Design Email Template

When you select the designed item, the Design Email Template program launches to define the email. Use
this program to build an email message that generates when BPM executes this action.
The template looks similar to any type of email with From, To, CC, BCC, Reply to, Subject and Email body. Many
of the fields in the template can contain values from the current directive record.
You can also insert field and table variables into these email messages. You do this by designing a Simple Query
that pulls in these values from fields. You use the Design Simple Query program to leverage this functionality.
Launch this program by right-clicking the Text field and selecting either the Field Query or the Table Query
options.
If Field Query is designated, you can select one field from any table in the current method's parameters. When
the application executes the directive action, a comma separated list of values from the query displays in the
message body.
If Table Query is designated, you can select more than one field from any table in the current method's
parameters. The application inserts table formatted values for each row query returns, including a header row.

Epicor ERP | 10.2.600 15


Use BPM to Send Email Advanced Business Process Management Course

Execution Rule

Click the with rule link to launch the Execution Rule program.
If the data transaction supports multiple dirty rows (rows that contain unsaved data), you can use this program
to select how the action performs. This variable is not visible if the method data transaction does not support
multiple dirty row updates.

Workshop - Send an Email

In this workshop, create a method directive to send an email when customer information changes. For example,
you can send a customer an email to verify changes to their address information or notify a sales representative
a customer has been approved.
Important Before you run this workshop, ensure that the SMTP Server that distributes email throughout
your company is defined in Company Maintenance. Much like a post office receives your mail and then
delivers it to various locations; the SMTP Server also receives your company’s email and then distributes it
through your company’s email application – for example, Microsoft® Outlook®.
If necessary, contact your system administrator for help.

Key concepts:
• Use the Post-Processing BPM workflow action to automatically send email when the master record changes.
• Build an email message.
• Insert a field variable into the email message.

Add a Post-Processing Directive


Navigate to Method Directives.
Menu Path: System Management > Business Process Management > Method Directives Maintenance
Important This program is not available in Epicor Web Access.

1. Click the Method Code button.


The Method Search window displays.

2. In the Search by Business Object section, verify Product is selected.


By selecting this option, Business Objects belonging to the application part of the system become available
for selection.

3. In the Business Object field, select Customer.

4. In the Where Method Name Starts At field, enter U and press the Search button.

5. Select the Update method and click OK.


The Erp.Customer.Update displays in the Method Code.

16 Epicor ERP | 10.2.600


Advanced Business Process Management Course Use BPM to Send Email

6. From the New menu, select New Post-Processing.

7. In the Directive Name field, enter XXX Send Email (where XXX are your initials).

8. In the Group field, enter XXX (where XXX are your initials).

9. Click Save.

Use Send Email Action

1. Click Design to launch the BPM Workflow Designer.


The available BPM workflow items display on the left portion of the screen.

2. In the workflow items tollbar, click the Send Email icon and drag it to the workflow pane of the Designer,
below the Start item.

3. Hover your mouse over the Start item.


The small black triangles surrounding the item represent the available connectors.

4. Click your mouse, select any of the Start connector symbols, drag the line and point it to any of the Send
Email element entry points.
The connection between the two elements is now established.

5. In the Actions pane found at the lower portion of the screen, view the Action statement:
send email asynchronously based on the designed template

6. Click the word asynchronously to set the synchronous execution.


For the purposes of this workshop, you want BPM to fire the email immediately when the action executes.

7. Click designed.
The Design Email Template program displays.

8. In the Name field, enter Send Customer Email.

9. In the From field, enter bpm@epicor.com.


Note In this example, you specified the From address directly in the bpm directive, however, entering
the address in this field is not mandatory. When you leave the From field empty, the BPM directive
first takes the current user's Email address defined in User Account Security Maintenance. If the user's
email address is not specified, the one specified in Company Maintenance is used.

10. In the To field, enter your email address.

11. In the Subject field, enter Customer Information was Updated.

12. In the message text box, enter Customer:.

13. Right-click after Customer: and select Field Query....


The Select Table Field(s) window displays.

Epicor ERP | 10.2.600 17


Use BPM to Send Email Advanced Business Process Management Course

14. In the Name field, enter CustomerID.

15. In the Table field, accept ds.Customer (ttCustomer).


This field displays the default temporary tables included in the current method parameters (arguments) along
with their real names.

16. For the Filter, select the Unchanged records.


Note Row Mod is not available in the post-process. Post processing directives cannot monitor whether
the record was added, updated, or deleted, only that the record is being passed back to the database
again.

17. In the Fields list, search for and select the CustID check box.

18. Click OK.

19. In the Design Email Template, click OK.

20. Click Validate and verify BPM reports no errors.

21. Click Save and exit the BPM Workflow Designer.

22. In Method Directives form, select the Enabled check box to activate the directive.

23. Click Save.

24. Minimize Method Directives.

Test the BPM


Navigate to Customer Maintenance.
Menu Path: Sales Management > Order Management > Setup > Customer

1. Navigate to the Customer sheet.

2. In the Customer field, enter Addison and press Tab.

3. In the Address field, change the number of the street address.

4. Click Save.

5. Check your email for the message.

6. Minimize Customer Maintenance.

You can now modify the directive to send an automatic email message to a customer to verify their record is
correct.

Change the Action


Change the action on the email directive to automatically notify the customer.
Maximize Method Directives.

18 Epicor ERP | 10.2.600


Advanced Business Process Management Course Use BPM to Send Email

1. Click Design to launch the BPM Workflow Designer.

2. In the BPM workflow, click the Send Email item.

3. Within the Action statement, click Send Customer Email.

4. In the Design E-mail Template window, clear the To value.

5. Right-click in the To field and select Field Query....

6. In the Name field, enter CustomerEmail.

7. In the Table field, accept ds.Customer (ttCustomer).

8. For the Filter, select Unchanged records.

9. From the Fields list, search for and select the EmailAddress check box.

10. Click OK.

11. In the line 2 of the email text, add the following additional message to the text: Your customer information
has been updated.

12. Click OK.

13. Click Validate to verify the BPM reports no errors.

14. Click Save and exit the BPM Workflow Designer.

15. Click Save and minimize the Method Directives window.

Test the BPM


Maximize to Customer Maintenance.

1. Verify the record for Addison is in focus.

2. On the Customer > Detail sheet, in the Email field, enter your email address.

3. Click Save.
The message is sent by BPM.

4. Check your email for the message.

5. Exit Customer Maintenance.

Disable Directive

1. Maximize the Method Directives window.

2. In the tree view, select the Post-Processing directive XXX Send Email.

3. In the Post-Processing > Detail sheet, clear the Enabled check box.

Epicor ERP | 10.2.600 19


Use BPM to Send Email Advanced Business Process Management Course

4. Click Save and exit Method Directives.

20 Epicor ERP | 10.2.600


Advanced Business Process Management Course Default Data To Updatable BAQ Records

Default Data To Updatable BAQ Records

Updatable BAQ directives initiate BPM actions based on method calls launched from an updatable BAQ. An
updatable BAQ is a customized query tool that displays on smart client dashboards and mobile device dashboards
through which users can update and add data; like a business object, BAQ methods are required so the database
can be updated. An updatable BAQ directive can be run before, after, or in place of the BAQ method call.
When you create an updatable BAQ, the application writes a base processing directive for the update method.
The directive uses the BPM code to update the database according to the settings defined in the Business Activity
Query Designer. You can edit this code to customize the update process, or you can add pre-processing, base
processing, and post-processing directives to the methods associated with the BAQ.
Each updatable BAQ has the following methods:
• GetList – Retrieves the data specified by the query.
• GetNew – Creates an empty row where a new record can be entered and submitted to the database.
• RunCustomAction – Runs a custom BPM action you define through both the BAQ and BPM functionality.
• Update – Performs database updates, refreshing the data to include changed and added rows.
• FieldUpdate - This method occurs after the user's change to a field is committed. You can use this method
to perform additional processing against the changed row. For example, when you enter a part number, you
want the part description field to populate automatically.
• FieldValidate - This method occurs before the proposed change to a field is committed. You can use this
method to validate proposed changes. For example, you can prevent users from entering an incorrect value
in a certain field such as non-existent state.

Workshop - Populate Data in Updatable Dashboard

In this workshop, use the directive to populate the contact’s address information with the customer’s address
information when the user creates a new contact within the Customer Contact Update dashboard.
Key concepts:
• Publish columns from a custom dashboard BPM directive will monitor.
• Add a directive to the updatable BAQ.
Note In order to complete this workshop, you must be provided with BAQ Advanced User rights granted
in User Account Maintenance. For more information, contact your system administrator.

Publish Dashboard Data


This workshop utilizes an updatable BAQ named UpdateCustContact, and a dashboard named CustContUpdate,
which already exist in the Epicor Demonstration Database.
The first part of the process is to publish the customer address information from the dashboard.
Navigate to the Dashboard.
Menu Path: Executive Analysis > Business Activity Management > General Operations > Dashboard
Important This program is not available in Epicor Web Access.

Epicor ERP | 10.2.600 21


Default Data To Updatable BAQ Records Advanced Business Process Management Course

1. Search for and select the dashboard CustContUpdate.


Ensure you are working in the Dashboard Developer mode. If necessary, turn on the Developer mode from
the Tools menu.

2. In the Dashboard Tree View, select the zCustomer01:Customer Tracker Query query.

3. From the Edit menu, select Properties.


The Dashboard Query Properties window displays.

4. Navigate to the Publish sheet.

5. In the Publish Columns list, accept the columns that have already been published out of the query and
select the check boxes next to the following column names:

Column Name
Customer_Address1
Customer_City
Customer_State
Customer_Country

6. In the Call Context Subscriber grid, click New.

7. From the Publish Column, select Customer_Address1.

8. In the BPMDataColumn, select Character01.

9. Repeat steps 5 - 7 to enter the following values:

Call Context Subscriber BPMDataColumn


Customer_City Character02
Customer_State Character03
Customer_Country Character04

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

11. Click Save.

12. Minimize the dashboard.

Get the Updatable BAQ Methods


The next step is to locate the GetNew method generated by the updatable BAQ.
Navigate to 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.

22 Epicor ERP | 10.2.600


Advanced Business Process Management Course Default Data To Updatable BAQ Records

1. Click Query ID, search for and select UpdateCustomerContact query.

2. Navigate to the Update > Update Processing sheet.

3. Click the BPM Directives Configuration to access the Updatable BAQ Method Directives.
In the Tree view, notice the list of methods; each of these methods can be monitored through Business
Process Management (BPM) directives.

4. From the list of methods, select the Ice.<CompanyName>/UpdateCustomerContact.GetNew method.

New Post-Processing Directive


Add a directive to the updatable BAQ. In this example, the directive will default a new contact’s address information
when the user creates a new contact using the Update Customer Contact dashboard. The directive uses the
information published from the dashboard to set the values in newly added contact records.

1. Click New and select New Post-Processing.

2. In the Directive Name field, enter XXX-Auto Populate Contact Address (where XXX are your initials).

3. Click Design to launch the BPM Workflow Designer.


Example The following image displays the BPM workflow you will build throughout this workshop.
You may use it for a reference as you go through the steps that follow.

Epicor ERP | 10.2.600 23


Default Data To Updatable BAQ Records Advanced Business Process Management Course

Build BPM Workflow


Use BPM Workflow Designer to build the workflow using the Set Field workflow actions. You want the workflow
to run each time the GetNew method is called; this directive will not use any condition statements.

1. In the workflow items tollbar, click the Set Field icon and drag it to the workflow pane of the Designer,
below the Start item.

2. Click your mouse, select any of the Start connector symbols, drag the line and point it to any of the Set
Field 0 element entry points.

3. Click the Set Field 0 element.

4. In the Actions pane found at the lower portion of the screen, view the Action statement:
set the specified field of the changed row to the specified expression

5. Click the first specified link.


The Select Table Field(s) window displays.

6. In the Table field, verify result.Results (ttResults) defaults in.

7. In the Fields grid, select the check box next to CustCnt_Address1.

8. Click OK to return to the BPM Workflow Designer.


The User Text now states:
set the ttResults.CustCnt_Address1 field of the changed row to the specifie
d expression

9. Click the drop-down next to the the changed row link.

10. From the list, select the added row.


The User Text now states:
set the ttResults.CustCnt_Address1 field of the added row to the specified
expression

11. Click the specified link.


The Specify C# expression window displays.

12. In the Available variables Tree View, expand the Call Context > callContextBpmData node.

13. Double-click Character01.


The Editor pane displays callContextBpmData.Character01.

14. Click the Check Syntax button to validate the expression. Use this feature to verify the expression is available
for use within the directive.

15. To the Syntax is OK message, click OK.

16. Click OK to return to the BPM Workflow Designer.

24 Epicor ERP | 10.2.600


Advanced Business Process Management Course Default Data To Updatable BAQ Records

The User Text now states:


set the ttResults.CustCnt_Address1 field of the added row to the callContex
tBpmData… expression
As a result, the action will set the Address field of a new row to the value published from the dashboard to
the Character01 field, which is the customer’s street address.
Note Each expression is automatically validated after you press the OK button. If BPM encounters a
validation error, a warning message is presented to the user. If the user decides to accept a wrongly
configured expression, the corresponding action or condition is marked as invalid.

17. Click Validate and verify the BPM reports no errors.

18. Add another three Set Field actions and connect them in the order they follow.
You may use the image displayed in the previous task for the reference.

19. Use steps 4 - 15 to set up each Set Field Action in order to populate the remaining fields published from
the dashboard.
Use the following table to set the action variables:

Item specified the changed row specified


Set Field 1 ttResults.CustCnt_City the added row callContextBpmData.Character02
Set Field 2 ttResults.CustCnt_State the added row callContextBpmData.Character03
Set Field 3 ttResults.CustCnt_Country the added row callContextBpmData.Character04

20. Once complete, click Save and exit the BPM Workflow Designer.
Return to Updatable BAQ Method Directives.

21. Select the Enabled check box.

22. Click Save.

23. Exit Updatable BAQ Method Directives.

Test Directive

1. Maximize the Customer Contact Update dashboard.

2. From the Tools menu, select Deploy Dashboard.

3. Click the Test Application button.


The dashboard displays.

4. Click Refresh to retrieve the customer data.

5. In the Customer Tracker Query grid, select the customer record for Addison.

6. In the Customer Contacts grid, click on any row.


The New button on the Standard toolbar becomes available.

Epicor ERP | 10.2.600 25


Default Data To Updatable BAQ Records Advanced Business Process Management Course

7. Click New.
A new row is added to the Customer Contacts grid.

8. In the grid, scroll to the right and verify the address information from the customer record is added to the
contact’s address fields.

9. In the Name field, enter your name.

10. Click Save.


The new customer contact is created.

11. Exit the testing dashboard.

12. Exit the Deploy Dashboard window.

13. Exit the Dashboard program.

Disable Directive

1. Maximize Business Activity Query Designer with UpdateCustomerContact query in focus.

2. Click BPM Directives Configuration to access the Updatable BAQ Method Directives.

3. Locate the XXX-Auto Populate Contact Address post-processing directive you created for the
Ice.<CompanyName>/UpdateCustomerContact.GetNew method.

4. Clear the Enabled check box.


The method directive is now disabled.

5. Click Save.

26 Epicor ERP | 10.2.600


Advanced Business Process Management Course Default Data To Updatable BAQ Records

6. Exit both Updatable BAQ Method Directives and Business Activity Query Designer.

Epicor ERP | 10.2.600 27


Set Text Properties Advanced Business Process Management Course

Set Text Properties

You can use a BPM to control the properties of text users enter in Epicor forms.

Workshop - Set Text Properties

In this workshop, set a master table code to always be in capital letters.


Note The example that follows uses the ShipVia Maintenance program, but the concept can be applied
to any master table.

Key concepts:
• Use method directive to build a workflow utilizing the Execute Custom Code action.
• Use Set Field action to modify text properties.

Create New Method Directive


Navigate to Method Directives.
Menu Path: System Management > Business Process Management > Method Directives Maintenance
Important This program is not available in Epicor Web Access.

1. Click the Method Code button.


The Method Search window displays.

2. In the Search by Business Object section, verify Product is selected.

3. In the Business Object field, select ShipVia.

4. In the Where Method Name Starts At field, enter U.

5. Click Search.

6. In the Search Results grid, select ShipVia Update method.

7. Click OK.

8. Verify the Method Code field displays Erp.ShipVia.Update business method.

9. Click New and select New Pre-Processing.


The Pre-Processing > Detail sheet displays.

10. In the Directive Name field, enter XXX - Set Code Case to CAPS (where XXX are your initials).

11. In the Group field, enter XXX (where XXX are your initials).

28 Epicor ERP | 10.2.600


Advanced Business Process Management Course Set Text Properties

Build BPM Workflow


Note You do not need to create a condition statement for this directive. When you do not define a
condition, the directive just executes each time its method is called – in this case, the ShipVia.Update
method.

1. Click Design to launch the BPM Workflow Designer.

2. From the Setters pane, select the Set Field action and drag it to the right of the Start element.

3. Click your mouse, select any of the Start connector symbols, drag the line and point it to any of the Set
Field element entry points.
The connection between the two elements is now established.

4. Click the Set Field action and view the statement:


Set the specified field of the changed row to the specified expression

5. Click the specified field link.

6. Verify the ds.ShipVia (ttShipVia) table defaults in.

7. Select the ShipViaCode field and click OK.

8. Click the specified expression link.


The Specify C# expression Editor window displays.

9. From the list of Available variables, select Temp-tables > ttShipVia (ds.ShipVia).

10. Double-click on the ShipViaCode.

11. From the list of Functions, expand String.

12. Double-click on ToUpper(x).

13. In the Editor window, remove the blank space and the BPM function so the expression looks like this:
ttShipViaRow.ShipViaCode.ToUpper()

14. Click the Check Syntax button and verify the expression reports no errors.

15. Click OK to close the Specify C# expression window.

16. Click the Validate button and verify BPM reports no errors.

17. Click Save and exit the BPM Workflow Designer.

18. In Method Directives form, select the Enabled check box to activate the directive.

19. Click Save.

20. Minimize Method Directives.

Epicor ERP | 10.2.600 29


Set Text Properties Advanced Business Process Management Course

Test the Directive


Navigate to Ship Via Maintenance.
Menu Path: Sales Management > Order Management > Setup > Ship Via

1. Click New.

2. In the Code field, enter xxx in lowercase letters (where xxx are your initials).

3. In the Description field, enter BPM Test - Set CAPS.

4. Click Save.
The BPM is fired and changes the ShipVia Code to upper case.

5. Exit Ship Via Maintenance.

Disable the Directive

1. Maximize Method Directives.

2. Verify the record in focus is XXX - Set Code Case to CAPS (where XXX are your initials) defined for the
business method ShipVia.Update.

3. Clear the Enabled check box.


The method directive is now disabled.

4. Click Save.

5. Exit Method Directives.

30 Epicor ERP | 10.2.600


Advanced Business Process Management Course BPM Data Form Designer

BPM Data Form Designer

Use BPM Data Form Designer to create forms invoked by BPM method directives.
The range of forms created using the BPM Data Form Designer can vary from a simple dialog with two buttons
(for example, Abort and Continue) to a dynamically generated form. The form can include a set of data entry
fields and allow entry of auxiliary data BPM uses to assign to data fields in the main dataset.
BPM data forms are intended to capture data or button actions to control a flow of BPM processing. You can
use this function to conditionally present a form (for example, only for a specific customer) to capture the specific
data required against a transaction for that customer.
Example You can design a form, which is invoked when some user action results in a negative inventory
balance. In this case, when the user tries to save the changes, the BPM data form displays and states "This
action will result in negative inventory balance". The user has two buttons either to continue or abort the
action.

You can call the BPM data form from a BPM method through the specified BPM directive. To call the BPM data
form from a specified method, use the workflow item Call BPM Data Form.

Workshop - Create a Form for User Input

In this task, create a BPM data input form to demonstrate how to enter consistent User IDs when setting up a
new user. This concept can be applied to a number of master table entry programs. To do this, you need to plan
what information is required to create a consistent ID, create the input form, create the BPM to call this input
form, and pull the user entered data to automatically create the new ID.
Key concepts:
• Create a BPM Data Input Form to prompt the user for information.
• Use BPM data in formulas within a directive.
• Understand how the GetNew method operates.

Create a BPM Data Form


Navigate to BPM Data Form Designer.
Menu Path: System Management > Business Process Management > BPM Data Form Designer
Important This program is not available in Epicor Web Access.

1. From the New menu, select New Form.

2. Enter the following information:

Field Data
FormID XXXUserPrompt (where XXX are your initials)
Form Title User Prompt
Form Text Enter User Information

Epicor ERP | 10.2.600 31


BPM Data Form Designer Advanced Business Process Management Course

3. Navigate to the Fields sheet.

4. From the New menu, select New Field.

5. Enter or select the following information:

Field Data
Field BPMData.Character01
Field Label First Name (delete "Field1:")
Field Format x(20)
Mandatory Select this check box.

6. Click Save.

7. From the New menu, select New Field.

8. Enter or select the following information:

Field Data
Field BPMData.Character02
Field Label Last Name (delete "Field2:")
Field Format x(25)
Mandatory Select this check box.

9. Click Save.

10. From the Actions menu, select Test BPM Data Form.

11. Enter your first and last name and click OK.
The testing form disappears.

12. Exit BPM Data Form Designer.

Locate the GetNewUserFile Method


Navigate to Method Directives.
Menu Path: System Management > Business Process Management > Method Directives Maintenance
Important This program is not available in Epicor Web Access.

1. Click the Method Code button.

2. In the Search by Business Object section, select System.

3. In the Business Object field, select UserFile.

4. In the Where Method Name Starts At search box, enter GetNew and click Search.

32 Epicor ERP | 10.2.600


Advanced Business Process Management Course BPM Data Form Designer

5. Select GetNewUserFile and click OK.


Verify the Method Code field displays Ice.UserFile.GetNewUserFile.

Add a Pre-Processing Directive

1. From the New menu, select New Pre-Processing.


The Pre-Processing > Detail sheet displays.

2. In the Directive Name field, enter XXX-Load BPM Form (where XXX are your initials).

3. In the Group field, enter XXX (where XXX are your initials).

4. Click Save.

5. Click Design to launch the BPM Workflow Designer.

6. In the workflow items tollbar, click the Call BPM Data Form icon and drag it to the workflow pane of the
Designer, below the Start item.

7. Click your mouse, select any of the Start connector symbols, drag the line and point it to any of the Call
BPM Data Form element entry points.
The connection between the two elements is now established.

8. Click the Call BPM Data Form workflow item.

9. In the Actions pane found at the lower portion of the screen, view the Action statement:
Call the named BPM Data Form using no customization always

10. Click named.


The Select BPM Data Form window displays.

11. Select XXXUserPrompt (where XXX are your initials).

12. Click OK.


Now add another action that passes the information to the post-processing directive.

13. In the workflow items tollbar, click the Enable Post Directive icon and drag it to the workflow pane of
the Designer, below the Call BPM Data Form item.

14. Click your mouse, select any of the Call BPM Data Form outbound connector symbols, drag the line and
point it to any of the Enable Post Directive element entry points.

15. Click Validate and verify the BPM reports no errors.

16. Click Save and exit the BPM Workflow Designer.

17. In Method Directives form, select the Enabled check box to activate the directive.

18. Click Save.

Epicor ERP | 10.2.600 33


BPM Data Form Designer Advanced Business Process Management Course

Add a Post-Processing Directive

1. From the New menu, select New Post-Processing.


The Post-Processing > Detail sheet displays.

2. In the Directive Name field, enter XXX-Set User Data (where XXX are your initials).

3. In the Group field, enter XXX (where XXX are your initials).

4. Click Save.

5. Click Design to launch the BPM Workflow Designer.

6. In the workflow items tollbar, click the Condition icon and drag it to the workflow pane of the Designer,
below the Start item.

7. Connect Start to Condition.

8. Click the Condition workflow item.

9. In the Condition pane click the New icon.

10. Form the list of conditions, select the following statement:


This directive has been enabled from the specified directive

11. Click specified.


The Select a primary directive to depend on window displays.

12. Verify the Pre: radio button (Pre processing directive) is selected.

13. In the Directive field, select XXX-Load BPM Form (where XXX are your initials).

14. Click OK.

Create Test Message


You need to verify the method runs when you expect. To test this, add an information message that displays
when the post-processing method activates.

1. Click and drag a Show Message element to the design canvas.

2. Select the Condition element; click and drag a connection line from the True arrow to the Show Message
element.

3. Select the Show Message element.


This Action Statement displays:
• Show informational message based on the designed template

4. Click the designed link.


The Design Information Message Template window displays.

34 Epicor ERP | 10.2.600


Advanced Business Process Management Course BPM Data Form Designer

5. For the Name, enter PostMsg1.

6. Now in the text field, enter Your post-processing directive works! (or something similar).

7. Click OK.

8. Click Save and exit the BPM Workflow Designer.

Enable and Save the Directive

1. Select the Enabled check box on the Post-Processing directive.


The directive is now active.

2. Click Save.

3. Minimize Method Directives.

Test the Method Directive


Navigate to User Account Maintenance.
Menu Path: System Setup > Security Maintenance > User Account Security Maintenance

1. From the New menu, select New User.


Notice the new BPM form displays.

2. Enter your first and last name.

3. Click OK.
The PostMsg1 displays.
Your new BPM Form is working.

4. Click OK.

5. Click Delete to remove new user created.

6. Minimize User Account Maintenance.

Build User ID Expression


Add another action that takes the field values from the BPM form and populates the field in User Maintenance.
You need to set the data in the temp table (tt) so entered data defaults into the form. First, create a formula to
construct the new UserID.
Maximize Method Directives.

1. Verify the Post-Processing > Detail sheet is in focus.

2. Click Design to launch the BPM Workflow Designer.

Epicor ERP | 10.2.600 35


BPM Data Form Designer Advanced Business Process Management Course

3. From the Setters panel, drag the Set Field action and place it below the Show Message. Connect both
actions.

4. In the action pane found in the lower portion of the screen, view the Action statement:
Set the specified field of the changed row to the specified expression

5. Click the first specified.

6. From the list of fields, select UserID and click OK. Verify the statement now reads:
Set the ttUserFile.UserID fields of the changed row to the specified expression

7. Now construct a UserID using the first letter of the first name and the last name. Click the specified link at
the end of the statement.

8. In the Specify C# expression window, from the list of Available variables, expand CallContextBpmData
and double-click Character01.

9. From the Functions panel, double-click String > x.Substring (y,z).

10. In the Editor pane, in the Substring parenthesis, enter (0,1).


This expression takes the first letter of the first name.

11. At the end of the current expression, enter +.

12. In the list of Available variables, double-click CallContextBpmData > Character02.


The expression is now complete. Verify it looks as follows:
callContextBpmData.Character01.Substring(0,1) + callContextBpmData.Charact
er02

13. Click Check Syntax and verify the expression reports no errors.

14. Click OK to close the Specify C# expression window.

Build Another Expressions


Following the same concept, use the Set Field actions to populate values in User Account Maintenance form.
Start by creating an expression to bind the First Name and Last Name into the Name field. You can also assign
user privileges through this BPM directive.

1. Drag the Set Field action and place it below the first Set Field action.

2. Connect both Set Field actions.

3. Click the first specified.

4. From the list of fields, select Name and click OK. Verify the statement now reads:
Set the ttUserFile.Name field of the changed row to the specified expression

5. Now construct a Name using the values entered in both Character01 and Character02 fields. Click the
specified link at the end of the statement.

36 Epicor ERP | 10.2.600


Advanced Business Process Management Course BPM Data Form Designer

6. In the Specify C# expression window, from the list of Available variables, expand CallContextBpmData
and double-click Character01.

7. At the end of the current expression, enter +.

8. Now add a space between the first and last name. After the + sign, enter " ". Make sure you leave space
between the brackets.

9. Add + to add new element.

10. In the list of Available variables, double-click CallContextBpmData > Character02.


The formula is now complete. Verify it looks as follows:
callContextBpmData.Character01 + " " + callContextBpmData.Character02

11. Click Check Syntax and verify the expression reports no errors.

12. Click OK to close the Specify C# expression window.

13. At this stage, you can add two more Set Field actions into the workflow and build the following expressions:

Action Name Action Phrase


Set Field 2 Set the ttUserFile.CanPersonalize field of the
changed row to the true expression

Set Field 3 Set the ttUserFile.CanUseEntSearch field of the


changed row to the true expression

The above two expressions assign personalization privileges to the user and allow usage of the Epicor
Enterprise Search application.

14. Click Save and exit the BPM Workflow Designer.

You return to the Method Directives window.

Save the Directive

1. Verify the Enabled check box is selected.

2. Click Save.

3. Minimize Method Directives.

Test the Method Directive


Maximize User Account Maintenance.

1. From the New menu, select New User.


Notice your BPM Form displays.

2. Enter your First Name and Last Name and click OK.

Epicor ERP | 10.2.600 37


BPM Data Form Designer Advanced Business Process Management Course

3. To the informative message, click OK.


Tip After you make sure the BPM method is working in the production environment, you can delete
the informational message action from the method.

4. Verify the BPM populates UserID and Name fields.

5. Click the Options tab. Verify the Allow Personalization and Allow Enterprise Seach privileges are
enabled for the user.

6. To complete creation of a new record, a user must be assigned to at least one company and site. Click New
> New Company. Assign the user to any existing company and site and click Save.

7. Exit User Account Maintenance.

Disable Directives
Maximize Method Directives.

1. Clear the Enabled check box on the Post-Processing directive.

2. Clear the Enabled check box on the Pre-Processing directive.

3. Click Save.

4. Exit Method Directives.

38 Epicor ERP | 10.2.600


Advanced Business Process Management Course Data Directives

Data Directives

Data directives initiate BPM actions based on updates to a specified table. A data directive can be run during the
data transaction, which can affect the information entered within the database, or it can be run after the data
transaction is placed within the table.
Two types of data directives include:
• In-Transaction - Affects data while it is being saved to the database. This directive type can only process one
row at a time; it cannot process multiple dirty rows. In-Transaction data directive executes within a transaction,
in the body of the trigger procedure.
• Standard - Does not affect data in the database. A Standard directive executes after a data transaction is
saved to the database. This directive type processes multiple dirty rows modified in the database. It runs after
base methods and method directives. Standard data directives are intended for audit purposes, for example
they can write some information to the application log.

Workshop - Prevent Entering Same Information Using BPM Code

In this workshop, prevent users from using the same PO number more than once per customer in Sales Order
Entry. Apply the in-transaction data directive on the OrderHed table and use an C# code to enforce that a PO
number is used only once per customer.
Key concepts:
• Use a data directive to monitor a field value.
• Throw an exception using the C# code.
Important This workshop requires a user is provided with Advanced BPM User rights. Due to security
restrictions, these rights are not available to Epicor Cloud ERP - Multi Tenant users. If you are using an
Epicor Cloud ERP - Multi Tenant environment, skip this workshop.

Locate the OrderHed Table


Navigate to Data Directives.
Menu Path: System Management > Business Process Management > Data Directives Maintenance
Important This program is not available in Epicor Web Access.

1. Click the Table button.


The Table Search window displays.

2. Verify Search by Table option is selected.

3. In the Table Name Starting At field, enter Order.

4. Click Search.

5. Select OrderHed and click OK.

Epicor ERP | 10.2.600 39


Data Directives Advanced Business Process Management Course

Add In-Transaction Directive

1. Click New and select New In-Transaction Directive.

2. In the Directive Name field, enter XXX-PO used once per customer (where XXX are your initials).

3. In the Group field, enter XXX (where XXX are your initials).

4. Click Design to launch the BPM Workflow Designer.

5. In the workflow items tollbar, click the Execute Custom Code icon and drag it to the workflow pane of
the Designer, below the Start item.

6. Click your mouse, select any of the Start connector symbols, drag the line and point it to any of the Execute
Custom Code element entry points.
The connection between the two elements is now established.

7. Click the Execute Custom Code workflow item.

8. In the Actions pane found at the lower portion of the screen, view the Action statement:
Synchronously execute custom code ...

9. Click the code link.


The Enter Custom Code window displays.

10. Verify the Code sheet is selected.

11. Enter the code below:


//*Prevent Using Same POs per Customer*/
var DuplicatedPOForCustomer =
ttOrderHed
.Where(ttOrderHed_Row =>
(string.Equals(ttOrderHed_Row.RowMod, IceRow.ROWSTATE_ADDED, StringC
omparison.OrdinalIgnoreCase) ||
string.Equals(ttOrderHed_Row.RowMod, IceRow.ROWSTATE_UPDATED, Strin
gComparison.OrdinalIgnoreCase)) &&
!string.IsNullOrEmpty(ttOrderHed_Row.PONum))
.Select(ttOrderHed_Row =>
Db.OrderHed
.FirstOrDefault(
OrderHed_Row =>
string.Compare(OrderHed_Row.Company, ttOrderHed_Row.Compan
y, true) == 0 &&
OrderHed_Row.CustNum == ttOrderHed_Row.CustNum &&
OrderHed_Row.OrderNum != ttOrderHed_Row.OrderNum &&
string.Compare(OrderHed_Row.PONum, ttOrderHed_Row.PONum, t
rue) == 0
)
)
.FirstOrDefault(conflictingOrder => conflictingOrder != null);
if (DuplicatedPOForCustomer != null)
{
throw new Ice.BLException(
string.Format("{0} is using the same PO Number. \rUnable to use the same
PO number for multiple Orders for a customer.",

40 Epicor ERP | 10.2.600


Advanced Business Process Management Course Data Directives

DuplicatedPOForCustomer.OrderNum));
}
Important When you copy and paste the above code from the pdf version of this course, you may
need to adjust it to make sure logical statements are kept together on their respective line.

Tip You may refer to the below image to view how the above C# code should be properly placed
within the complier.

12. In the Enter Custom Code window, click OK.

13. In the Actions pane, verify the Action field displays the following:
synchronously execute custom /*Prevent Using Same POs per Customer*/... rec
ord nothing

14. Click the Validate button and verify BPM reports no errors.

15. Click Save and exit the BPM Workflow Designer.

16. In Method Directives form, select the Enabled check box to activate the directive.

17. Click Save.

18. Minimize Method Directives.

Test Data Directive


Navigate to Sales Order Entry.
Menu Path: Sales Management > Order Management > General Operations > Order Entry

1. Click New.

Epicor ERP | 10.2.600 41


Data Directives Advanced Business Process Management Course

2. In the Customer field, enter Dalton and press Tab.

3. In the PO field, enter a number of your choice.

4. Write down the PO number you have entered _______ .

5. Click Save.

6. Write down the Sales Order number created _______ .

7. Click the Clear button.

8. Click the New button again.

9. In the Customer field, enter Dalton and press Tab.

10. In the PO field, enter the number you used in step 3.

11. Click Save.


The Error message displays, informing you that another Sales Order for this customer is using the same PO
Number.

12. To the Error message, click OK.

13. Click the Clear button.

14. To the confirmation message, click Yes.


Now, you will create another Sales Order using the same PO number for a different customer. The expected
behaviour is that you will be able to create the new record.

15. Click the New button again.

16. In the Customer field, enter Barriston and press Tab.

17. In the PO field, enter the number you used in step 3.

18. Click Save.


The new record saves successfully, as the BPM only prevents users from using the same PO number more
than once per specific customer.

19. Exit Sales Order Entry.

Disable Directive

1. Maximize Data Directives.

2. Verify the record in focus is XXX-PO used once per customer (where XXX are your initials.

3. Clear the Enabled check box.

4. Click Save.

5. Exit Data Directives.

42 Epicor ERP | 10.2.600


Advanced Business Process Management Course Business Object Method Call

Business Object Method Call

You can use the Invoke BO Method action to call Business Object (BO) methods from within a directive.
This action eliminates the need to perform call to different BO methods using custom code, as this approach
requires knowledge of C# programming language.
In order to prepare or receive data from the BO method call, you typically use directive level variables and table
actions - Fill Table By Query and Update Table by Query. You can use directive level variables to supply data into
external method parameters, reference them across available conditions and actions, pass and receive data from
BO call actions or to hold intermediate results during directive execution. Note that usage of directive level variables
is limited to the directive where they were defined. Intermediate data they hold can not be passed between
multiple directives.
The table actions introduced in this course section are used to add (Fill table by Query) or update data (Update
Table by Query) within an in-memory table. In-memory table can be either a temporary table (ttTable) passed as
an argument to the Business Object method, or, it can be a directive-level variable of Tableset type.

Workshop - Use Fill Table By Query and Invoke BO Method

In this workshop, assume that on a customer record, a value in the City field has been modified. You want to
alert the sales department within your company that any open orders for that customer should be updated to
reflect this change. To log the information, use one of the delivered user-defined tables UD01.
Key concepts:
• Create a directive level variable
• Create a BPM Query referencing both in-memory (records being updated) and standard database tables
(existing records)
• Prepare data for the Business Object method call

Create New Method Directive


Navigate to Method Directives.
Menu Path: System Management > Business Process Management > Method Directives Maintenance
Important This program is not available in Epicor Web Access.

1. Click the Method Code button.


The Method Search window displays.

2. In the Search by Business Object section, verify Product is selected.

3. In the Business Object field, select Customer.

4. In the Where Method Name Starts At field, enter U.

5. Click Search.

Epicor ERP | 10.2.600 43


Business Object Method Call Advanced Business Process Management Course

6. In the Search Results grid, select the Update method and click OK.

7. Verify the Method Code field displays Erp.Customer.Update business method.

8. Click New and select New Pre-Processing.


The Pre-Processing > Detail sheet displays.

9. In the Directive Name field, enter XXX - CustomerAlert (where XXX are your initials).

10. In the Group field, enter XXX (where XXX are your initials).

11. Click Save.

Create Workflow Skeleton


First, design the skeleton of the workflow used in this workshop.

1. On the Pre-Processing > Detail sheet, click Design to launch the BPM Workflow Designer.

2. Place the following workflow items on the designer canvas:


• Condition
• Fill Table By Query
• Invoke BO Method.

3. Create the following connections:

a. Connect Start to Condition.

b. Connect the Condition's True outbound exit to the Fill Table By Query action.

c. Connect the Fill Table By Query action to the Invoke BO Method action.

4. Verify the workflow looks similar to the following:

44 Epicor ERP | 10.2.600


Advanced Business Process Management Course Business Object Method Call

Configure Condition
Configure the condition to fire the directive when a city is changed on a customer master record.

1. In the designer canvas, click the Condition item to select it.

2. In the Condition pane at the bottom, click the Add Line icon.

3. From the list of available conditions, select the following condition:


The specified field has been changed from any to another

4. Click specified.

5. Verify the Table field displays ds.Customer (ttCustomer).

6. Search for the City field and select it.

7. Click OK to exit the Select Table Field(s) window.

The condition is now prepared.

Configure Invoke BO Method Action


Before you configure Fill By Query Table action to prepare data for the BO method call, you can configure the
Invoke BO Method to specify which method you want to call. Since you want to store data in a directive-level
variable, you create it while you configure parameters of this method call. This way, you make sure the variable
type you create corresponds with the method parameter type you want to assign to it.

1. In the designer canvas, click the Invoke BO Method action to select it.

Epicor ERP | 10.2.600 45


Business Object Method Call Advanced Business Process Management Course

2. In the Actions pane found at the lower portion of the screen, view the Action statement:
Invoke specified BO method with specified parameters

3. Click the first specified link.

4. Since user-defined tables belong to framework part of the application, on the Choose BO Method window,
select System.

5. From the drop-down list, select UD01.

6. Search for and select the UpdateExt method.

7. Click the second specified link to configure what data will be passed as parameters to this method.

8. Notice the first parameter of this method named ds (dataset). This parameter uses the INPUT-OUTPUT
direction, which indicates the method receives data from this parameter and potentially returns the updated
data into the variable of the same type.
Note If you know the type of required variable in advance, you can use the Variables tab within the
Designer to create it. In this example, use another way of creating a directive level variable directly
from within the action where it will be used.

9. For the ds parameter, click the Binding drop-down list and select create new variable.

10. In the Create new variable window, notice the required variable Type defaults in.
In this case, the required type is Ice.Tablesets.UpdExtUD01Tableset.

11. For the Name, enter UD01LogRecords and click OK.


Important Usage of directive level variables is limited to the directive where they were defined. Any
intermediate data they will hold can not be passed between multiple directives.

12. Now specify the two INPUT parameters which pass data into the method. These are required parameters
that must be supplied.

13. For the continueProcessingOnError parameter, invoke the Binding drop-down list. Notice the two available
options:
• create new variable - as discussed in previous steps, you would use this option to create a new variable.
In this case, the simple (scalar) variable of the boolean type would be created.
• expr: specified expression - use this option to launch the Specify C# expression window to compose
an expression assigned to this parameter.

14. In this example, create an expression for the continueProcessingOnError parameter.

a. From the Binding drop-down list, select expr: specified expression.

b. Click specified expression.

c. In the Specify C# expression window, in the Editor pane, enter false.

d. Click OK.

This expression ensures the processing will not continue if an error occurs.

46 Epicor ERP | 10.2.600


Advanced Business Process Management Course Business Object Method Call

15. Now create an expression for the rollbackParentOnChild parameter.

a. From the Binding drop-down list, select expr: specified expression.

b. Click specified expression.

c. In the Specify C# expression window, in the Editor pane, enter true.

d. Click OK.

This expression ensures consistency of data when it is processed.

16. Now specify the two OUTPUT parameters which return data from the method call.
Note The Business Object method does not require any data from the parameters of this direction.
You can either assign these method parameters to variables of the same type, or, you can select the
[ignore] binding if you do not need to assign any value.

17. In this example, for both the errorsOccured and <return value> parameters, select [ignore].

18. In the Setup Method Parameters window, click OK.

19. In BPM Workflow Designer, click the Variables tab at the bottom. Verify the newly created variable is
present.
Note You can use this tab to create new variables, view existing ones, rename them, change their
types and to delete them.

The Invoke BO Method action is now configured.

Design BPM Query


In this task, begin to configure the Fill Table By Query action. This action is used to add data into a target in-memory
table. In-memory table can be either a temporary table (ttTable) passed as an argument to the Business Object
method, or, it can be a directive-level variable of the Tableset type.
First, you must design a BPM query. When you construct the query, you can reference both in-memory tables,
such as ttCustomer and standard database tables such as ERP.Customer. To complete the query, you must
explicitly set which columns you want to display in the result set.

1. In the designer canvas, click the Fill Table By Query action to select it.

2. In the Actions pane found at the lower portion of the screen, view the Action statement:
Use the designed query to insert data into the specified table with specified
mapping

3. Click designed to launch the Compose Query window.

4. For the Query Name, enter CustomerOrders.

5. Place the following tables on the designer canvas:


• ttCustomer - this table will supply the modified value of the customer city record.
• ERP.Customer - this table will provide the original value of the customer city record.
• ERP.OrderHed - this table will provide the list of open orders for the customer that should be updated.

Epicor ERP | 10.2.600 47


Business Object Method Call Advanced Business Process Management Course

6. Notice ERP.Customer and ERP.OrderHed tables automatically link. Select this link.
The Table Relations sheet displays.

7. Change the following relations:

Customer field OrderHed field


Company Company
CustNum CustNum (change this from BTCustNum)

8. Create relation between the ttCustomer and ERP.Customer tables.

a. Click the Add Connection button and link both tables.

b. On the Table Relations sheet, create the following relations:

ttCustomer field Customer field


Company Company
CustNum CustNum (change this from ParentCustNum)

9. Now apply criteria on the OrderHed table to only retrieve open orders.

a. Click the ERP.OrderHed table on the canvas.

b. On the Table Criteria sheet, click Add Row.

c. In the Field column, select OpenOrder.

d. In the Operation column, accept the default value equals (=).

e. In the Filter value column, select specified constant.

f. Click specified to launch the Specify Value window.

g. Enter true and click OK.

10. Now select the fields to display in the result set.

a. Select the Display Fields sheet.

b. Select the following fields:

Field What Data It Provides


ttCustomer_Company intermediate table - the customer record being updated
ttCustomer_CustID intermediate table - the customer record being updated
ttCustomer_City intermediate table - the customer record being updated
Customer_City database table - the original value of the customer city record
OrderHed_OrderNum database table - the list of open orders for that customer

48 Epicor ERP | 10.2.600


Advanced Business Process Management Course Business Object Method Call

11. In the Compose Query window, click OK.

Select Target Table


Now select the target in-memory table where data from the BPM Query will be inserted. In this example, you
select the directive level variable of the TableSet type you created for this directive.

1. In the Action phrase, click specified.


The Select Table window displays.

2. From the Table drop-down list, scroll down and select UD01LogRecords.UD01.
This indicates you are inserting records into the UD01 table of the UD01LogRecords directive level variable.

3. Click OK.

Configure Table Mappings


To complete the action, configure how records are be mapped to the in-memory table. The number of records
added to the selected table is equal to the number of records returned from the BPM Query.

1. In the Action phrase, click the specified mapping link.


The Setup Table Mapping window displays, presenting all fields available within the UD01LogRecords.UD01
table.

2. For the Company column, from the Binding drop-down list, select field: ttCustomer_Company.

3. For the Key1 column, from the Binding drop-down list, select field: ttCustomer_CustID.

4. For the Key2 column, build an expression that stamps the current time.

a. From the Binding drop-down list, select expr: specified expression.

b. Click the specified expression link to launch the Specify C# expression window.

c. From the Functions list, expand the Date branch and double-click Now.
This adds the following function to the Editor:
BpmFunc.Now()

d. Since the Key2 column expects the string type of data, you must convert the datetime format to string.
To do so, place the cursor right after the brackets.

e. From the Functions list, expand the Conversion branch and double-click x.ToString().
Verify the expression now reads:
BpmFunc.Now().ToString()

f. Click OK.

5. For the Key3 column, build an expression to ensure a unique key is created for each sales order that needs
to be updated. To accomplish this task, create a unique GUID for each row.

a. From the Binding drop-down list, select expr: specified expression.

Epicor ERP | 10.2.600 49


Business Object Method Call Advanced Business Process Management Course

b. Click the specified expression link to launch the Specify C# expression window.

c. In the Editor pane, type the below expression:


System.Guid.NewGuid().ToString()

d. Click OK.

6. For the Key4 column, build the expression that marks all records created by this directive in the UD01 table.
This approach helps you to identify the source of data updates, if needed.

a. From the Binding drop-down list, select expr: specified expression.

b. Click the specified expression link to launch the Specify C# expression window.

c. In the Editor pane, type the below expression:


"CustomerCityChange"

d. Click OK.

7. For the Character01 column, build an expression that alerts the users to update the affected sales orders.

a. From the Binding drop-down list, select expr: specified expression.

b. Click the specified expression link to launch the Specify C# expression window.

c. In the Editor pane, enter the below expression:


string.Format(
"Attention: Reroute order#{0} from {1} to {2} for customer {3}",
queryRow.OrderHed_OrderNum,
queryRow.Customer_City,
queryRow.ttCustomer_City,
queryRow.ttCustomer_CustID)
Note Note that in this message, parameters inside the brackets are substituted with data returned
by the BPM Query. In the Specify C# expression window, notice the Query row branch is found
at the bottom of the Available variables pane. It displays the list of columns you selected for display
when you designed the BPM Query. This way, you can use the rows returned by the query to make
up the expression.

d. Click OK.

8. For the RowMod column found at the bottom of the Columns list, build an expression that marks all records
as added to the table.

a. From the Binding drop-down list, select expr: specified expression.

b. Click the specified expression link to launch the Specify C# expression window.

c. In the Editor pane, type the below expression:


"A"

d. Click OK.

9. In the Setup Table Mapping window, click OK.

50 Epicor ERP | 10.2.600


Advanced Business Process Management Course Business Object Method Call

10. Click Validate and verify the directive reports no errors.

11. Click Save and exit the BPM Workflow Designer.

12. In Method Directives form, select the Enabled check box to activate the directive.

13. Click Save and minimize Method Directives.

Modify Customer Record


Navigate to Customer Maintenance.
Menu Path: Sales Management > Order Management > Setup > Customer

1. Retrieve the record for customer Addison.

2. In the City field, delete the existing record and enter Green Bay.

3. Click Save to trigger the BPM directive.

4. Minimize Customer Maintenance.

Test the Directive

1. Verify the records were updated into the UD01 table. Construct a Business Activity Query against the
Ice.UD01 table.

2. Verify the results look similar to the following:

The data written in the user-defined table using the BPM directive would now be ready for further processing.

Epicor ERP | 10.2.600 51


Business Object Method Call Advanced Business Process Management Course

Disable Directives

1. Maximize Method Directives.

2. Clear the Enabled check box for both XXX - CustomerAlert and XXX - UD01Update directives you
recently created.

3. Save the directives and exit the Method Directives program.

52 Epicor ERP | 10.2.600


Advanced Business Process Management Course Customization and BPM

Customization and BPM

BPM directives can interact with customizations, so you can leverage these tools together to address a business
need. BPM directives can both monitor and populate unique fields you have added to a customization.

Update Table By Query

Use this action to update data within an in-memory table. In-memory table can be either a temporary table
(ttTable) passed as an argument to the Business Object method, or, it can be a directive-level variable of Tableset
type.
Configure this action through the following process:
• First, design a BPM query. When you construct the query, you can reference both in-memory tables, such as
ttCustomer and standard database tables such as ERP.Customer. To complete the query, you must explicitly
set which columns you want to display in the result set. You can then use the query rows to update the
information within a target table.
• Specify which row set within an in-memory table is affected, when this action activates. You can select added
rows, deleted rows, updated rows, added and updated rows, changed rows, unchanged rows and all rows.
• Select a single in-memory table serving as the target for the data update.
Important If you need to update more than one table within a Tableset, for example, OrderHed and
OrderDtl, you must use two Update Table By Query actions within the workflow.

• Specify the relation between the target table and the BPM Query. This relation defines how rows returned
by the query are associated with existing table rows.
• Specify how data is assigned to the target table columns.
Note When this action executes, the data is first retrieved from a BPM Query. This data is then matched
with selected set of rows from a target in-memory table, for example, with added rows. This matching is
based on rows returned by the query and the relation specified between the query and the target table
defined on the Setup Table Mapping window.

Workshop - Populate Additional Fields from a Related Table

In this workshop, create a BPM method directive that pulls additional fields from the part master into the sales
order line, when the part number is changed. This concept can be applied to a number of forms where changing
a key field should pull additional information from a master table specific to that change. For example, industry
specific fields like specification class along with numeric fields for grade can be pulled into the order line to match
customer requirements or custom pricing rules.
Key concepts:
• Understand how the ChangePartNumMaster method works.
• Use the Update Table by Query action to retrieve additional information outside the current dataset.
• Use conditions to handle new as well as changing rows.

Epicor ERP | 10.2.600 53


Customization and BPM Advanced Business Process Management Course

Customize Sales Order Entry


In this task, customize the sales order form by adding two fields. Bind these fields to OrderDtl.ShortChar10 and
OrderDtl.Number10, which are custom fields available for use within Epicor ERP 10. Later in the workshop, you
will build a BPM workflow to populate these fields, when the part information changes.
While this workshop utilizes existing custom columns, customers using on-premise installations (hosted within
an organization) are free to add their own user-defined columns through User-Defined Column Maintenance.
The User-Defiend Fields section in the application help and the Customization User Guide > Customization
Utilities > Global Customization Tools > User-Defined Fields section describes how they add these fields.
The below image displays the customization created in this task. You may use it for a reference as you proceed
through the steps that follow.

1. Click the arrow at the bottom of the Epicor ERP window to display a toolbar. On the left side of this toolbar,
select the Developer Mode (the wrench) button. A line now appears through this wrench icon to indicate
Developer Mode is active.
Tip If you use the Classic Style menu, you activate Developer Mode from the Main Menu. Either click
the Developer Mode button on the top toolbar or click Options > Developer Mode.

2. Navigate to Sales Order Entry.


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

3. In the Select Customization window, review the Default Customization Programming Language
section. Verify the C# option is selected.

4. If you are using an on-premise environment, you can select Base Only and click OK. If you are using an
Epicor Cloud ERP environment, review the Available Layers tree view. Select the SalesOrderForm icon
and click OK.

54 Epicor ERP | 10.2.600


Advanced Business Process Management Course Customization and BPM

Sales Order Entry displays. You can now create a customization using the base form.

5. Add a GroupBox:

a. From the Tools menu, select Customization.

b. In Sales Order Entry, select the Lines > Detail sheet.

c. In the Customization Tools Dialog window, from the Tools menu, select ToolBox.
This displays the ToolBox you use to add controls to the sheet.

d. In the ToolBox, select EpiGroupBox.

e. Click in the space below the Adv Bill Bal field. If the Select Layer Type window appears, select
Customization and click OK.

f. Draw the epiGroupBoxC1 group box so it fits two fields inside it.
You can use the handles (the white squares) on the control to adjust the size of the group box.

g. In the Customization Tools Dialog, locate the Text property and change the group box caption to
display BPM.

6. Add a Text Box:

a. If the Toolbox is not displayed, return to the Customization Tools Dialog window. From the Tools
menu, select the ToolBox.

b. In the ToolBox, click EpiTextBox.

c. Click inside the Adv BPM group box.

d. In the Customization Tools Dialog, specify the following properties:

Text delete the content


Epibinding OrderDtl.ShortChar10
Size 114, 19
Read Only true

e. Position the text box into the top-right portion of the group box.

7. Add a Numeric Editor:

a. In the ToolBox, click EpiNumericEditor.

b. Click inside the Adv BPM group box, below the TextBox.

c. In the Customization Tools Dialog, specify the following properties:

Numeric Type Decimal


Epibinding OrderDtl.Number10
Size 114,19

Epicor ERP | 10.2.600 55


Customization and BPM Advanced Business Process Management Course

8. Add Labels:

a. In the Toolbox, click EpiLabel.

b. Click inside the Adv BPM group box.

c. Position the EpiLabel to the left of the Textbox.

d. In the Customization Tools Dialog, change the Text property to SC 10.


This text now displays in the epiLabel. You may need to expand the handles on the label to display the
entire text.

e. Select the text box.

f. Return to the Properties sheet. In the EpiControl section, locate the EpiLabel property.

g. Click the down arrow next to this property. Under the Suggested node, select epiLabelC1.

h. Repeat substeps a. - g. to create another label for EpiNumericEditor. For the Text property, use NUM
10. For EpiLabel property, select epiLabelC2.

9. In the Customization Tools Dialog window, click Save.

10. For Name, enter XXX_AdvBPM (where XXX are your initials) and click Save.

11. In the Customization Comment window, click OK.

12. Exit the Customization Tools Dialog.

13. Exit and re-open the Sales Order Entry form.


The Select Customization window displays.

14. Select the XXX_AdvBPM customization (where XXX are your initials) and click OK.

15. Deactivate the Developer Mode and minimize Sales Order Entry.

Review Part Master Data


User-defined fields in the part master table need to be populated with data, which will pulled into the Sales Order
Line. There are several ways to setup data for the this exercise, but the easier is to use an Updatable BAQ. This
example uses an existing BAQ to view and update data in the part table.
Navigate to Business Activity Query Designer.
Menu Path: System Management > Business Activity Queries > Business Activity Query
Important This program is not available in Epicor Web Access.

1. Click Query ID, search for and select BAQ PartsAdvancedBPM.

2. On the General, view the Query Phrase. Notice the fields being returned from the query include PartNum
and two User fields. The query is configured to only return records for specific parts, such as MP-1018,
MP-1019 and MP-1020.

3. Navigate to the Analyze sheet.

56 Epicor ERP | 10.2.600


Advanced Business Process Management Course Customization and BPM

4. Click the Get List button to return rows from the Part table.

5. Note that parts have pre-populated data in the User fields.


Tip Since this query allows data updates, a user having Advanced BAQ rights is able to modify these
values to verify they are pulled into the sales order line.

6. Minimize Business Activity Query Designer.

Add a Pre-Processing Directive


Add a Method Directive for OrderEntry.ChgPartNumMaster method.
Navigate to Method Directives.
Menu Path: System Management > Business Process Management > Method Directives Maintenance
Important This program is not available in Epicor Web Access.

1. Click the Method Code button.

2. In the Search by Business Object section, verify Product is selected.

3. In the Business Object field, select SalesOrder.

4. Search for and select ChangePartNumMaster method.


Verify the Method Code field displays Erp.SalesOrder.ChangePartNumMaster.

5. From the New menu, select New Pre-Processing.


The Pre-Processing > Detail sheet displays.

6. In the Directive Name field, enter XXX-Change PN Enable Post (where XXX are your initials).

7. In the Group field, enter XXX (where XXX are your initials).

8. Click Save.

9. Click Design to launch the BPM Workflow Designer.

10. In the workflow items tollbar, click the Enable Post Directive icon and drag it to the workflow pane of
the Designer, below the Start item.

11. Connect Start and Enable Post Directive elements.

12. Click Validate and verify the BPM reports no errors.

13. Click Save and exit the BPM Workflow Designer.

14. In Method Directives form, select the Enabled check box to activate the directive.

15. Click Save.

Epicor ERP | 10.2.600 57


Customization and BPM Advanced Business Process Management Course

Add a Post-Processing Directive


Add a Method Directive for OrderEntry.ChgPartNumMaster method.
Navigate to Method Directives.
Menu Path: System Management > Business Process Management > Method Directives Maintenance
Important This program is not available in Epicor Web Access.

1. Click the Method Code button.

2. In the Search by Business Object section, verify Product is selected.

3. In the Business Object field, select SalesOrder.

4. Search for and select ChangePartNumMaster method.

5. From the New menu, select New Post-Processing.


The Post-Processing > Detail sheet displays.

6. In the Directive Name field, enter XXX - Set PN User Data (where XXX are your initials).

7. In the Group field, enter XXX (where XXX are your initials).

8. Click Save.

9. Click Design to launch the BPM Workflow Designer.

10. In the workflow items toolbar under the FlowChart category, click the Condition icon and drag it to the
workflow pane of the designer, below the Start element.

11. Connect Start to Condition.

12. Click the Condition workflow element and click the New icon.

13. From the list, select the following statement:


the specified field of the changed row is equal to the specified expression

14. Click the specified field link.

15. From the list of tables, select ds.OrderDtl (ttOrderDtl).

16. Search for and select the PartExists field.

17. Click the specified expression link.

18. In the Specify C# expression Editor, enter true.

19. Click OK to close the Specify C# expression Editor.

58 Epicor ERP | 10.2.600


Advanced Business Process Management Course Customization and BPM

20. Verify the condition looks as follows:


the ttOrderDtl.PartExists field of the changed row is equal to the true...
expression
As the result, the condition will go through the Update Table by Query action only if this is a part master
part.

Create Test Message


Verify the method runs when you expect using an information message that displays when the post-processing
method activates.

1. Click and drag a Show Message element to the design canvas.

2. Select the Condition element; click and drag a connection line from the True arrow to the Show Message
element.

3. Select the Show Message element. This Action Statement displays:


Show informational message based on the designed template

4. Click the designed link.


The Design Information Message Template window displays.

5. For the Name, enter PostMsg1.

6. Now in the text field, enter AdvBPM Post Msg 1 - Directive fired (or any other descriptive text).

7. Click OK.

8. Click Save and exit the BPM Workflow Designer.

9. In Method Directives form, select the Enabled check box to activate the directive.

10. Save and minimize Method Directives Maintenance.

Test the Method Directive

1. Maximize Sales Order Entry.


If Order Entry is no longer open, launch the form using the Developer Mode and open the UI customization
named Adv_BPM.

2. Click New to create a new order.

3. For Customer, enter Addison.

4. In the PO field, enter a number of your choice.

5. In the Need by field, select next Friday.

6. Navigate to the Lines > Detail sheet.

7. Click New > New Line.

Epicor ERP | 10.2.600 59


Customization and BPM Advanced Business Process Management Course

8. In the Part/Rev field, enter MP-1018 and press Tab.


Note the BPM fires and displays the message box.

9. Click OK to the message and minimize Sales Order Entry.

Add an Action
Add an action that takes the field values from the Part Master table and populates the fields on the Order Line
based on the selected Part Number.

1. In the workflow items toolbar under the Setters category, click the Update Table by Query element and
drag it to the workflow pane of the designer.

2. Connect the True side of the Condition to Update Table by Query element.

3. Click the Update Table by Query workflow element and view the statement:
Use the designed query to update all rows of the specified table with specified
mapping

4. Click designed.

5. In the Query Name field, enter PartUDF.


This identifier stands for Part Master User Defined Fields.

6. In the Filter field, enter part.

7. Click and drag the Erp.Part table onto the design canvas.

8. Now click the Display Fields tab and add the following columns to the list of Display Column(s):
• Company
• PartNum
• UserChar1
• UserDecimal1

9. Click OK to close the Compose Query window.

10. Click the all rows drop-down icon and from the list, select added and updated rows.

11. Now click the specified (table) link.

12. From the list of tables, select ds.OrderDtl (ttOrderDtl).

13. Click OK to close the Select Table window.

Configure Table Mapping

1. With the Updateble Table by Query action in focus, click the specified (mapping) link.
The Setup Table Mapping window displays.

60 Epicor ERP | 10.2.600


Advanced Business Process Management Course Customization and BPM

2. First, create relations between the table and the query as per the below table. To create a new row, click
the Add Relation icon.

ttOrderDtl table Query


Company Part_Company
PartNum Part_PartNum

3. In the columns filter, enter ShortChar and locate the ShortChar10 field.

4. From the Binding drop down list, select the specified expression option.

5. You will use the If-Then-Else condition for this field. From the list of Operators, expand Condition.

6. Double-click on x ? y : z condition.

7. Verify the cursor is placed inside parenthesis. Now from the list of Available variables, double click on
Query row > Part_UserChar1.

8. Now add not equal empty string formula by modifying the expression as per below:
(queryRow.Part_UserChar1 !="")

9. Place your cursor after ? and from the list of Available variables, double click on Query row >
Part_UserChar1 again.

10. Lastly, after :, enter "".

11. Verify the expression looks as follows:


(queryRow.Part_UserChar1 !="") ? queryRow.Part_UserChar1 : ""

12. Click OK to close the Specify C# expression window.

13. In the columns filter, enter Number and locate the Number10 field.

14. Repeat steps 4 - 12 to build the following expression:


(queryRow.Part_UserDecimal1 !=0) ? queryRow.Part_UserDecimal1 : 0

15. You have finished the table mapping. Click OK to close the Setup Table Mapping window.

Extend the Condition


Now we need to cover the situation where the PartNum is not in the Part Master. If the part is not in the Part
Master, we need to set UserDecimal1 to 0 and the UserChar1 to blank.

1. In the workflow, click the Condition element.

2. Extend the current condition by clicking the New icon.

3. From the list of statements, select the below condition:


the specified field of the changed row is equal to the specified expression

Epicor ERP | 10.2.600 61


Customization and BPM Advanced Business Process Management Course

4. Click the specified field link.

5. From the list of tables, select ttOrderDtl (ds.OrderDtl).

6. Search for and select the PartExists field.

7. Click the specified expression link.

8. In the Specify C# expression Editor, enter true.

9. Click OK to close the Specify C# expression window.

10. Verify the condition looks as follows:


the ttOrderDtl .PartExists field of the changed row is equal to the true
expression
As the result, the condition will go through the Update Table by Query only if this is a part master part.

Complete the Workflow


We need to handle the condition when the selected part is in the part master but is changed to a non-part master
part. When the condition exists, we need to clear what ever is currently entered into the Number10 and
ShortChar10 fields. We can do this with a Set Field element.

1. From the Setters pane, select Set Field and drag is to the right of the Condition element.

2. Drag and arrow from the False side of the Condition element to the Set Field element.

3. Click the Set Field and view the statement:


Set the specified field of the changed row to the specified expression

4. Click the specified field link.

5. From the list of tables, select ds.OrderDtl (ttOrderDtl).

6. Search for and select the Number10 field.

7. Click the specified expression link.

8. In the Specify C# expression Editor, enter 0.

9. Click OK to close the Specify C# expression window.

10. Now add another Set Field element and place it to the right of the Set Field 0 item.

11. Click the specified field link.

12. From the list of tables, select ds.OrderDtl (ttOrderDtl).

13. Search for and select the ShortChar10 field.

14. Click the specified expression link.

15. In the Specify C# expression Editor, enter "".

62 Epicor ERP | 10.2.600


Advanced Business Process Management Course Customization and BPM

16. Click OK to close the Specify C# expression window.

17. Connect the two Set Field items.

18. Click Validate and verify the BPM reports no errors.

19. Click Save and exit the BPM Workflow Designer.

20. Select the Enabled check box and Save the directive.

Test the Method Directive

1. Maximize Sales Order Entry.

2. Click New > New Order.

3. In the Customer field, enter Dalton and press Tab.

4. Click New > New Line.

5. On the Lines > Detail sheet, for Part Number, enter either MP-1018, MP-1019, or MP-1020. These parts
have the UD fields populated in the test database.

6. Note the Fields in the AdvBPM group box display the values from the Part table.
These values are taken from Part_UserChar1 and Part_UserDecimal1 fields. You can use an existing
updatable BAQ to modify the existing values and verify the changes are reflected on the sales order form.

7. Change the Part Number to a Part Master part that does not have User fields populated. For example, enter
DSS-1010.

8. Note that Number10 and ShortChar10 fields display no values.

9. Change the Part Number to YourName.

10. Again, no values display for Number10 and ShortChar10 fields.

11. Change the Part Number back to MP-1018, MP-1019, or MP-1020.

12. Fields are again populated with User-defined data.

13. Exit Sales Order Entry without saving.

14. Navigate back to Method Directives and disable the XXX-Change PN Enable Post directive.

Epicor ERP | 10.2.600 63


Using External Methods Advanced Business Process Management Course

Using External Methods

You can create custom external methods using the C# or Visual Basic .NET programming languages. Through
this feature, you can implement complex external methods that extend or replace the functionality on server-side
application business logic.
You can create external methods for method, data, and updatable BAQ directives. These custom BPM external
methods are public, typically static methods that accept the same parameters as the method you are extending.
Because of this, custom external methods are directly integrated with the Epicor application.
Important This functionality is only available if your user account has BPM Advanced User permissions.
Advanced BPM User rights are not available to Epicor Cloud ERP - Multi Tenant Users, as freeform
C# code may introduce a security risk for access of data outside of the tenancy. Use of C# in BPMs is
regulated, and requires advanced approval from Cloud Operations to ensure conformity with our security
and operational standards. Most common business requirements for reading and writing data within the
tenancy restrictions can be accomplished by using the built in interface. To request a feature requiring BPM
Advanced User rights, contact Epicor Professional Services or an authorized Epicor partner. You can also
submit a request to CloudCodeReview@epicor.com for deployment.

You begin by creating a custom action within the BPM module. You do this by generating a class within a method
that has a suitable signature. You then open the generated class within a .NET environment where you enter the
code for the custom external method. Lastly, you deploy the custom external method to the application. You
can then use the custom external method with either a method directive or an updatable BAQ directive.
Through this feature set, you can also create Service Connect workflows for method, data, and updatable BAQ
directives. By creating these workflows, you can set up directives that move data out of the Epicor application.
This integrates the data generated by this directive with the Service Connect application. Once this data is available
in Service Connect, you can then link it to another Epicor application or a third-party application for display and
use.
This part of the course describes how you use the BPM tools to create and enter custom code. However, specific
details about the C# or Visual Basic .NET languages are beyond the scope of this course. For more information,
refer to the various reference guides and training manuals available for the programming languages or contact
your Epicor Account Manager.

Workshop - Create External Method

In this workshop, learn how to build an external method, deploy it to the server and call it from within the BPM
workflow.
To successfully complete this workshop, Microsoft® Visual Studio® 2010 or later must be installed and operational
in your environment.
Important This workshop requires a user is provided with Advanced BPM User rights. Due to security
restrictions, these rights are not available to Epicor Cloud ERP - Multi Tenant users. If you are using an
Epicor Cloud ERP - Multi Tenant environment, skip this workshop.

Access Method Arguments


The Method Arguments window displays the arguments contained in the current method or updatable BAQ;
use this program to review what you need to know before you build your external method. You can also use
this program to launch the Programming Interface Generator Form; you use this window to generate a class

64 Epicor ERP | 10.2.600


Advanced Business Process Management Course Using External Methods

within a method that has a signature which matches the signature of the business object for which you are
creating the external method. You launch the Method Arguments window from either Method Directives
Maintenance or Updatable BAQ Directives Maintenance.
Navigate to Method Directives.
Menu Path: System Management > Business Process Management > Method Directives Maintenance
Important This program is not available in Epicor Web Access.

1. Click the Method Code button to find and select the method that you need.
Example The example used in this workshop uses the Erp.ABCCode.Get List method.

2. Click the Advanced... button.


Note To access this feature, you can also click the Actions menu and select the Advanced option.

3. Notice the BpmArgumentName field displays the name of the argument.

4. Remain in the Method Arguments window.

Use Programming Interface Generator Form


Use the Programming Interface Generator Form to create a custom external method for the selected business
object method, data table, or updatable BAQ.
If you are creating an external method for an updatable BAQ or method directive, you launch the Programming
Interface Generator Form from the Method Arguments window. If you are creating an external method for a
data directive, you launch this window in Data Directives Maintenance by selecting a table and then clicking the
Create Programming Interface... button.

1. Click the Create Programming Interfaces... button to launch the Programming Interface Generator
Form.

2. In this example, verify the .Net Assembly [C#] radio button is selected.
Notice the C# code shell for the custom action is generated on the .NET Action Template - C# sheet.

3. Click Save.

Epicor ERP | 10.2.600 65


Using External Methods Advanced Business Process Management Course

4. The .Net destination folder window displays.

5. Navigate to the folder where you create your external assemblies. Typically this is application server directory
path location Server\Customization\Externals.

6. Click Save and save this file to C:\inetpub\wwwroot\ERP10\Server\Customization\Externals.

7. Select all the C# code and copy.

8. Exit the Programming Interface Generator Form and minimize Method Directives window.

Define External Method Logic


To create your custom action, you open the external method template within your programming environment.
You do this differently, depending on whether you are developing a C# or a VB.NET external method.
Most transactions start with a GetNew or GetByID method to either populate default values into the dataset or
retrieve existing data from the database. The client keeps a copy of the original row and sends this row back
through an Update method along with the updated row. The server then compares the original copy of the row
to the current row on the actual, or physical, database to make sure it did not change from another source before
it updates the row. In these cases, only the changed row has an A (Add), U (Update), or D (Delete) value in the
table’s RowMod column.
When you write .NET code, be sure you identify the correct row within the tableset. You must do this because
the Update method creates two copies of the row within the inbound dataset. If the copy of the returned row
to the client does not match the actual database, you receive an error and future updates also fail. This feature
is part of the Optimistic Record Locking Mechanism; it applies to both conditions and actions.
Note When you attach an external method to a business object or updatable BAQ, it must have a signature
which matches the signature of the business object method or BAQ. If it does not, the external method
does not display on the methods list when you select an Invoke External Method action on a method or
updatable BAQ directive. These external methods always take simple parameters by reference and complex
parameters by value.

In this example, enter the programming logic for a custom AbcCode.GetList() external method written in C# .NET
to filter out all records where AbcCode starts with an "A".
® ®
1. Launch Microsoft Visual Studio .

2. Create an empty Class Library C# project; name it ABCCodeGetListDemo.

3. Select the code in the Class1.cs and replace it with your copied code.

4. Right-click the References node in the Solution Explorer and add the following references:
• Epicor.ServiceModel - C:\inetpub\wwwroot\ERP10\Server\Bin\Epicor.ServiceModel.dll
• Epicor.System - C:\inetpub\wwwroot\ERP10\Server\Bin\Epicor.System.dll
• Erp.Contracts.BO.ABCCode -
C:\inetpub\wwwroot\ERP10\Server\Assemblies\Erp.Contracts.BO.ABCCode.dll
• Erp.Data.910100 - C:\inetpub\wwwroot\ERP10\Server\Assemblies\Erp.Data.910100.dll
• Ice.Data.Model - C:\inetpub\wwwroot\ERP10\Server\Assemblies\Ice.Data.Model.dll
• System.Data.Entity -
C:\ProgramFiles(x86)\ReferenceAssemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Data.Entity.dll

5. Click each Epicor reference and in the Properties pane, set Copy Local property to False.

66 Epicor ERP | 10.2.600


Advanced Business Process Management Course Using External Methods

6. At the top of the Class1.cs code, change using System.ServiceModel to using Epicor.ServiceModel.

7. Write the custom business logic in the body of the method. In this example, you are creating a post-processing
directive for AbcCode.GetList() to filter out all records where AbcCode starts with an "A" value. Edit the
GetList method to look like this:

8. In the code, change the namespace to Erp.BpmCustomCode.

9. Make the following changes in Project Properties:

a. On the Application tab, for Target network, select .NET Framework 4.6.1 (or the latest .NET framework
currently supported by Epicor).

b. On the Build tab, specify the following Output path:


C:\inetpub\wwwroot\ERP10\Server\Customization\Externals\

c. Click the Reference Paths tab and add paths to the Epicor Assemblies and Bin folders.

10. Save your solution and click Build > Build Solution.

Epicor ERP | 10.2.600 67


Using External Methods Advanced Business Process Management Course

Call External Method

1. Return to Method Directives with Erp.ABCCode.GetList business object method focus.

2. Click New > New Post-Processing.

3. In the Directive Name field, enter XXX-CustomGetList (where XXX are your initials).

4. In the Group field, enter XXX (where XXX are your initials).

5. Click the Design... button to invoke the BPM Workflow Designer.

6. From the Callers group, click and drag the Invoke External Method item to the workflow design area.

7. Click and drag a connection from the Start item to the Invoke External Method item.

8. Accept the default Synchronous execution of this task.

9. Next select the external method you have created. Click the external link.
The Add Reference window displays, showing the custom external methods you have created and deployed
to the External Storage folder. Typically its directory path is the Server\Customization\Externals location.
Select the custom external method from the list.

10. Select your custom external method from the list and click OK.

11. Now click the specified method link and select method you want to invoke. In this example, the GetList
method is selected.

68 Epicor ERP | 10.2.600


Advanced Business Process Management Course Using External Methods

12. Notice the two additional columns displayed for your information. The Is Static column displays Yes when
the assembly method is static. Otherwise, No is displayed.

13. The Requires BPM Context column displays Yes if a BPM Context is passed over to the selected external
method. If the method does not utilize a BPM Context data, the column displays No.
Tip Within an external method accessing the BPM context, the BPM context parameter must be
declared as its last parameter. For example:

14. At this stage, your workflow should look similar to the following.

15. Click the Save button and close the designer.

16. On the Detail sheet, select the Enabled check box to activate the directive.

17. Save the record and minimize Method Directives.

Test the Method


Your custom external method filters any ABC codes that start with the "A" character. To verify this custom
external method works, launch a program that uses the GetList method to retrieve ABC codes.
Navigate to Warehouse Maintenance.
Menu Path: Material Management > Inventory Management > Setup > Warehouse

1. Select a warehouse, for example, select Inspection Area.

Epicor ERP | 10.2.600 69


Using External Methods Advanced Business Process Management Course

2. From the New menu, select New ABC Code.

3. The Cycle Count/Physical Inv > ABC Codes > ABC Code Detail sheet activates.

4. To find and select a code, click the ABC Code... button.

5. The ABC Code Search window displays.

6. Click the Search button.

7. Notice in the Search Results, the "A" ABC code does not display as an option. Through your external method,
users can no longer select this filtered ABC code.
Your result should look similar to the following:

70 Epicor ERP | 10.2.600


Advanced Business Process Management Course Using External Methods

8. Close the Search dialog and exit Warehouse Maintenance.

Disable Directive

1. Maximize Method Directives.

2. Verify the record in focus is XXX-CustomGetList (where XXX are your initials).

3. Clear the Enabled check box.


The method directive is now disabled.

4. Click Save.

5. Click Clear and remain in Method Directives.

Epicor ERP | 10.2.600 71


Managing Method Directives Advanced Business Process Management Course

Managing Method Directives

To complete the Business Process Management (BPM) functionality, the module includes programs that help
manage your method directives. You can export your directives to another location where they can then be
imported into another system. You can also update the directives.

Groups
This functionality requires you use groups. Each group contains related method directives. By placing related
method directives together, you can easily export, import, and update the directives.
You create and select groups within the Method Directives, Data Directives, or Updatable BAQ Method Directives
programs. The Detail sheets in these programs all have a Group field. Use this field to create new groups or to
select existing groups. In either case, you define the group which the directive is placed inside for use in later
processes.
Recall within the previous workshops, you assigned each directive to a group represented by your initials. This
way, all directives you created belong to the same group, allowing you to import, export or update them all at
once.

Directive Export
Use Directive Export to export all method directives that belong to a selected group. These directives are then
exported to a single file at a location you define, so you can move your method directives to another installation
of the application.
Menu Path: System Management > Business Process Management > Directive Export
Important This program is not available in Epicor Web Access.

Directive Import
Use Directive Import to import a group of exported method directives into your application.
Menu Path: System Management > Business Process Management > Directive Import
Important This program is not available in Epicor Web Access.

Directive Update
Use Directive Update to perform mass updates of BPM directives:
• Use the Directive Update Setup sheet to update the properties and recompile the directives within a selected
group. You can run this program to apply some primary options to all the group directives; for example, you
can use this program to enable all the directives in a group.
• Use the Directive Recompile Setup sheet to recompile a group of directives, optionally refreshing signatures
of the methods or tables they are attached to, in order to make them compatible with the current version of
the application.
• Use the Directive Cleanup Setup to remove a selected group of directives. This functionality is particularly
relevant in multi-company and multi-tenant installations. Security and Global Security managers can use this
utility to remove selected groups of directives in a specified scope across all available companies and tenants.

72 Epicor ERP | 10.2.600


Advanced Business Process Management Course Managing Method Directives

• Use the SC Credentials Setup sheet to perform mass update of ESC server credentials stored in directives.
Typically, you need to update ESC credentials when running cross-company directives utilizing ESC Workflow
actions in a non-owning company.

Menu Path: System Management > Business Process Management > Directive Update
Important This program is not available in Epicor Web Access.

Workshop - Export Directives

In this workshop, export your directive group.


Navigate to Directive Export.
Menu Path: System Management > Business Process Management > Directive Export
Important This program is not available in Epicor Web Access.

1. Select the Directives by Group option.

2. In the Directive Group field, select XXX (where XXX are your initials).

3. Click the Export to File button.

4. Select Desktop.

5. In the File Name field, verify export displays.

6. Click Save.

7. Click the Export button.

8. In the Information message, click OK.

9. Exit Directive Export.

10. Verify the Export.bpm file displays on your desktop.

Workshop - Import Directives

In this workshop, import the directive file you exported previously.


Navigate to Directive Import.
Menu Path: System Management > Business Process Management > Directive Import
Important This program is not available in Epicor Web Access.

1. Click the File Name button.

Epicor ERP | 10.2.600 73


Managing Method Directives Advanced Business Process Management Course

2. In the Open window, verify Desktop is selected.

3. Select the Export.bpm file.

4. Click Open.

5. For the Destination Group, select XXX (where XXX are your initials).

6. Select the Replace Existing Group check box.


Note Select this check box if you want the import program to delete the directives in the existing
group and replace them with the imported directives. If this check box is clear, the program leaves
the existing directives alone and adds the imported directives into the group.

7. Click the Import button.

8. In the Information message, click OK.


View the information about re-imported directives.

9. Exit Directive Import.

74 Epicor ERP | 10.2.600


Advanced Business Process Management Course Calling Epicor Functions

Calling Epicor Functions

Epicor Functions allow for creating your own processes and calculations as functions.
Functions can call into the application server logic or database tables just as you can with BPM directives. You
can then validate, manipulate, or execute actions based on the data passed through the Function with parameters
as you define. Because they are server side customization, you can reuse a Function across any client as well as
from BPM directives.
Functions give you the ability to define exactly the service, method and parameters you wish to expose dynamically.
It also allows you to define exactly which parts of Epicor ERP you wish to interact with - ERP Services, Assemblies,
or Database Tables. Due to this declarative approach, upgrades can be handled more easily.
Functions are created within a library. Library is Functions' single unit of deployment, import, or export.

Workshop - Use Invoke Function Widget in BPM Workflow

In this workshop, create a Function in Epicor Functions Maintenance and call it from a BPM Directive workflow.
During this workshop:
• You will first create a library that will store your Function.
• You then create a Function that will generate a custom log based on a UD table.
The Function will accept two string parameters - Severity and Message, add a new row to a system
user-defined table (UD100).
• Then, in your BPM workflow, you will add an Invoke Function widget where you will specify your Function
and map its parameters to expressions.
• Next, you will test the directive.
Important The default security setup when only the calls from the Function's Owning Company are
authorized is sufficient for testing purposes. In this example, the Function is created in the Epicor
Education (EPIC06) Company, but you can do it in a different Company if you like. however, calling a
Function from a different Company requires additional security setup. Please refer to the last step of
the workshop for details.

Tip Because Functions are reusable logic, you can conduct additional testing of your Function from
other BPM Directives too.

• Finally, you will set up security and publish the library.


Important Only members of the Functions Developer or Functions Power Developer security groups
can add new libraries. Make sure that your user account is assigned to one of these groups.

Create a Library

1. Open the Epicor Functions Maintenance program.


By default, the Summary sheet displays.

2. In the Library field, type in the ID of your new library - for example, MyLog, and press Tab.

Epicor ERP | 10.2.600 75


Calling Epicor Functions Advanced Business Process Management Course

To the message offering to add a new record, click Yes.


Tip You can also add a new library entry form by clicking:
• File > New > Add Library from the Main Menu, or
• New > Add Library from the Main Toolbar.

Important A library ID must be at least one character long while its maximum allowed length is
limited by 30 characters. It can contain only letter characters, digits, or dashes. It must begin with a
letter and cannot end with a dash. It must not match, but may contain keywords used in C#
programming - for example, new, class, private, public, etc.
If you enter any restricted character, an error message displays. You cannot change the ID once the
library is saved.

3. Enter a short Description of your new library - for example, Custom log library.

4. Keep the default settings.


Note These settings apply to all Functions in this library. For the purpose of this workshop, you don't
need any of these settings.

5. Navigate to the References > Services sheet and click the Add button.
The Search window displays.

6. Search for and select the UD100 service. Click OK.


The added service displays - ICE:BO:UD100.
Note Library references are available for use in any Function within a library.

7. Click Save.

Create a Function

1. From the Main Menu of the Epicor Function Maintenance program, navigate to File > New > Add
Widget Function or click New > Add Widget Function from the Main Toolbar.
The Function sheet displays with an active entry form.

2. Enter a Function ID - for example, write-to-log.


Tip A function ID must be at least one character long and can contain only letter characters, digits,
or dashes. It must begin with a letter and cannot end with a dash. It must not match, but can contain
keywords used in C# programming - for example, new, class, private, public, etc.).
Note You cannot change the ID once the Function is saved.

3. Enter a short Description of your Function: Adds a new record to log based on UD100 table.

4. Keep default values for other Function settings.

76 Epicor ERP | 10.2.600


Advanced Business Process Management Course Calling Epicor Functions

Define Parameters

1. Navigate to the Function > Signature sheet to add Function parameters.

2. On the Function > Signature sheet, click Edit to add new parameters.
Select a line in the Request Parameters section.

3. Type in Severity for the first parameter's Name.

4. For the parameter's Data Type, select System.String.

5. Add the second request parameter of the same data type with the name of Message.
This Function does not provide any output, therefore you don't need to add any response parameters.

6. When you are done with adding Function parameters, click Complete.
Parameter details display in read-only mode.

7. Click Design to launch Function Designer.

Design Workflow

Use the available widgets to construct the workflow of your function.

1. Navigate to Properties > Variables and click the New icon.


A line for a new variable displays:

a. Add a name for the variable: ds.

b. Click the Down Arrow next to the default data type and select Choose type.
The Select type window displays.

c. Navigate to the Services sheet and expand the ICE:BO:UD100 node.

d. Select Ice.Tablesets.UD100Tableset and click OK.

2. From the Callers panel, select the Invoke BO Method widget and drag it to the design canvas.

3. Configure the action on the Properties > Actions sheet:

a. Click the first specified link.


The Choose BO Method window displays.

b. Click Search.

c. From the results, select GetaNewUD100 and click OK.

d. Click the second specified link.


The Setup Method Parameters window displays.

e. In the Binding field of the ds method parameter, select the newly created ds variable - var: ds.
Thus, the in-out parameter of the GetaNewUD100 method is mapped to a Function-level variable.

4. From the Setters panel, select the Update Table by Query widget and drag it to the design canvas.

Epicor ERP | 10.2.600 77


Calling Epicor Functions Advanced Business Process Management Course

5. Configure the action on the Properties > Actions sheet:

a. Click the designed link.


The Compose Query window displays.

b. On the Phrase Build sheet, select the ds.UD100 table.

c. On the Display Fields sheet, expand the ds_UD100 node in the Available Columns panel and select
the SysRowID field, and click OK.

d. From the all rows toggle, select the added rows option.

e. Click the first specified link and, in the Select Table window, click OK to confirm the selection of the
ds.UD100 table.

f. Click the second specified link and, in the Setup Table Mapping window, add binding for the necessary
ds.UD100 table fields as specified below:

Name Binding (Note)


Key1 Expr: DateTime.UtcNow.ToString This expression adds current date and time to
() true the field.
Character01 If the Severity request parameter is not passed
Expr: string.IsNullOrEmpty (sev
into the Function or its value is not specified,
erity)
this expression sets the value of this field to
? "INFO" INFO.
: severity.ToUpperInvariant (
)

Character02 If the Message request parameter is not passed


Expr: string.IsNullOrEmpty(mess
into the Function or its value is not specified,
age)
this expression sets the value of this field to
? "<empty>" <empty>.
: message

6. From the Callers panel, select another Invoke BO Method widget and drag it to the design canvas.

7. Configure the action on the Properties > Actions sheet:

a. Click the first specified link.


The Choose BO Method window displays.

b. Click Search.

c. From the results, select Update and click OK.

d. Click the second specified link.


The Setup Method Parameters window displays.

e. In the Binding field of the ds method parameter, select the ds variable - var: ds.

8. Save the workflow and exit the Function Designer.

78 Epicor ERP | 10.2.600


Advanced Business Process Management Course Calling Epicor Functions

Create a Method Directive


In this workshop, you will add a post-processing directive to the Erp.Customer.Update method.

1. Navigate to the Detail sheet of the Method Directive Maintenance.

2. Click the Method Code button.


The Method Search window displays.

3. In the Business Object field, select Customer and click Search.

4. From the Search Results, select Update and click OK.

5. In the Tools menu, click the Down Arrow next to the New icon and select New Post-Processing.

6. Add a Directive Name - for example, LogChanges.

7. Click Design.
The BPM Workflow Designer displays.

Design Workflow

1. From the Callers panel, select the Invoke Function widget and drag it to the design canvas.
The action statement displays in the Properties > Actions panel: Call library / function using specified
parameters.

2. Click the library link and select the MyLog library.

3. Click the function link and select the write-to-log function.

4. Click the specified link.


The Setup Function Parameters window displays.

5. Specify Binding for the two Function parameters:

a. Bind the Severity parameter to the following expression: "INFO".

b. Bind the Message parameter to the following expression: "Customer " + ttCustomerRow.Cus
tID + " updated successfully!".

6. Save the workflow and exit the BPM Workflow Designer.

7. Enable and save the directive.

Test the Directive

1. In the Customer Maintenance, open ADDISON's record.

2. Change the Phone number to 608-347-8389.

3. Save the record.

Epicor ERP | 10.2.600 79


Calling Epicor Functions Advanced Business Process Management Course

4. Now, in Business Activity Query, add a new query. For the Query ID, enter TestCustomLog.

5. Navigate to the Query Builder > Phrase Build sheet and drag the Ice.UD100 table to the canvas.

6. On the Query Builder > Display Fields sheet move the following fields to the Display Column(s) grid:
Key1, Character01, Character02.

7. Navigate to the Analyze sheet and click Test.


Data from the selected fields of the Ice.UD100 table display - for example:

Key1 Character01 Character02


10/10/2019 2:33:33 INFO Customer ADDISON updated successfully!
PM

Publish the Library


You have created and designed a Function and tested it by calling it from a BPM Directive. In this final step you
need to:
• define what Companies will have access to the Function and
• publish the library to make it available to users.
If you wish your published Function be available in more than one Company within an organization, you need
to explicitly add respective Companies to the Authorized Companies list, including the Function's Owning
Company.

1. In Epicor Functions Maintenance, navigate to the Security sheet.

2. From the Available Companies column, select Epicor Education and Epicor USA and click the Right
arrow.
The Epicor Education and Epicor USA companies display in the Authorized Companies column.

3. In the Main menu, select Actions > Promote Library to Production.

4. Click Yes to the warning message.


The library is now available for public use and displays in read-only mode.

5. Save the library.

You have successfully created a reusable Function and tested it by calling it from a BPM Directive with an Invoke
Function widget. You then made it available for public use by promoting the library to production.
You can call the same Function from any other BPM Directives as well as via REST.

80 Epicor ERP | 10.2.600


Advanced Business Process Management Course Debugging Using Visual Studio

Debugging Using Visual Studio

If you have Microsoft® Visual Studio™ 2010 or higher, you can debug execution of custom code directives.
Important This process requires access to a server file system or an application database and therefore,
debugging of BPM directives is only available if you are using an on-premise environment (hosted within
your organization). Due to security restrictions, this option is not available to Epicor ERP Cloud users.

Prerequisites

This topic discusses steps you need take to before you start debugging.
The Epicor Customization Framework (ECF) supports two ways of storing generated assemblies. The preferred
method, which is either SQL BLOB (Binary Large Object) or File System Storage is defined in the Epicor ERP 10
web.config file within the customizationStorage provider property.
Before you start debugging, do the following:
• On the server your Epicor Application Server is running from, locate the folder for the application server you
want to debug from. If you don't know how to find this folder, you can use IIS Manager to locate it. Search
Windows programs to find the Internet Information Services (IIS) Manager program.

• Navigate to the application server web site which is located under Sites > Default Web Site node. Right-click
the application server name and select Explore.

Epicor ERP | 10.2.600 81


Debugging Using Visual Studio Advanced Business Process Management Course

• This will open a Windows Explorer file browser window in that location. The path may look as follows: C:\
inetpub\wwwroot\ERP102100\Server
• In order to load the program database (pdb) file that holds debugging symbols, verify the loadPdb property
found in the web.config is set to true and the intermediateFolder path is set to the Server BPM folder.
Example The addition to web.config settings may look as follows:
<customizationSettings disabled="false" intermediateFolder="C:\inetpub\w
wwroot\ERP102100\Server\BPM" loadPdb="true">

• To reload customization assembly and debug symbols, restart IIS. Alternatively, only restart the Epicor ERP
application pool.

Debug BPM Directive

This topic explains how you can debug customization assembly compiled by the Epicor Customization Framework.

1. By default, sources are found in the BPM folder of the Server directory.

82 Epicor ERP | 10.2.600


Advanced Business Process Management Course Debugging Using Visual Studio

Note A different sources folder can be specified using the intermediateFolder attribute in the server
web.config file.
Make sure that the folder specified in the intermediateFolder attribute exists at the time IIS AppPool
used by the Epicor 10 application starts. Also, verify the account used by that AppPool has read and
write access to that folder. Otherwise, the setting is ignored and sources are saved in the system's
TEMP folder.

2. Notice each folder contains all BPM revisions.


Important New sources are generated each time you save the directive. Make sure you are working
with the latest BPM sources when debugging a directive.

3. Open Visual Studio and do not open a solution. It must be a blank session so we can drag and drop files
on to a blank solution form.

4. From the most recent folder under the BO folder containing your BPM versions, select all of the .cs files,
then drag and drop on to the blank Visual Studio solution form.

Epicor ERP | 10.2.600 83


Debugging Using Visual Studio Advanced Business Process Management Course

5. All of the files will load into Visual Studio and can now be attached to a process.

6. From the Visual Studio tool bar menus, select Debug and then Options… For Debugging Options, make
sure the Enable Just My Code and Require source files to exactly match the original version options
are clear.

84 Epicor ERP | 10.2.600


Advanced Business Process Management Course Debugging Using Visual Studio

7. Find the current w3wp.exe process ID:

a. You may use the Performance and Diagnostics tool and find it under Live Memory Inspection.

b. Alternatively, in IIS manager, select the level server node and double-click the Worker Process icon.

8. From the Visual Studio tool bar, select Debug > Attach to Process. Attach the debugger to the w3wp.exe
process the application pool is running under.

Epicor ERP | 10.2.600 85


Debugging Using Visual Studio Advanced Business Process Management Course

9. Notice the Stop and Pause Icons are active on the top button bar. This means you are actively debugging.
Navigate to the program tab that has the name of your BPM included in it and set a break point.

86 Epicor ERP | 10.2.600


Advanced Business Process Management Course Debugging Using Visual Studio

10. Run the routine in the Epicor client. When the BPM customization is fired, the breakpoint is activated and
you can step through the c# code for the BMP in the in the Visual Studio debugger.

11. If the breakpoint is not hit, do the following:

a. Close the Epicor client.

b. Restart IIS, or Epicor server application pool.

c. Launch the Epicor client again and regenerate the directive to update directive sources.

Tip By default, IIS7 app pool can only use 90 seconds span for a non-responsive application. During
IIS web application or website debugging time, you may want to change its corresponding application
Pool advanced setting's "Ping Maximum Response Time" to a time much longer, or turn off "Ping
Enabled" setting.

Epicor ERP | 10.2.600 87


Conclusion Advanced Business Process Management Course

Conclusion

Congratulations! You have completed the Advanced Business Process Management course.

88 Epicor ERP | 10.2.600


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