Sei sulla pagina 1di 54

Epicor ERP

Advanced Business Process


Management Course
10.0.700
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 2014.
All rights reserved. No part of this publication may be reproduced in any form without the prior written consent of
Epicor Software Corporation.

ED879905
90521-10-9221-584702
10.0.700
Revision: June 08, 2014 5:13 p.m.
Total pages: 54
course.ditaval
Advanced Business Process Management Course Contents

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

Epicor ERP | 10.0.700 3


Contents Advanced Business Process Management Course

Workshop - Create a Form for User Input.......................................................................................................29


Create a BPM Data Form........................................................................................................................29
Locate the GetNewUserFile Method........................................................................................................30
Add a Pre-Processing Directive................................................................................................................31
Add a Post-Processing Directive..............................................................................................................32
Show Informational Message..................................................................................................................32
Enable and Save the Directive.................................................................................................................34
Test the Method Directive.......................................................................................................................34
Add an Action........................................................................................................................................34
Save the Directive...................................................................................................................................35
Test the Method Directive.......................................................................................................................36
Disable the Directive...............................................................................................................................36
Data Directives......................................................................................................................37
Workshop - Prevent Entering Same Information Using BPM Code..................................................................37
Locate the OrderHed Table.....................................................................................................................37
Add In-Transaction Directive...................................................................................................................38
Test Data Directive..................................................................................................................................39
Disable Directive.....................................................................................................................................40
Using External Methods.......................................................................................................42
Workshop - Create External Method..............................................................................................................42
Access Method Arguments.....................................................................................................................42
Use Programming Interface Generator Form...........................................................................................44
Define External Method Logic.................................................................................................................44
Call External Method..............................................................................................................................47
Test the Method.....................................................................................................................................48
Disable Directive.....................................................................................................................................49
Manage Method Directives..................................................................................................50
Workshop - Export Directives.........................................................................................................................50
Workshop - Import Directives.........................................................................................................................51
Conclusion.............................................................................................................................53

4 Epicor ERP | 10.0.700


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 using the C# programming.
Create BPM forms invoked by method directives.
Use Data Directives to initiate actions when updates to specific tables occur.
Learn how to create and call Custom External Methods.
Manage method directives.

Epicor ERP | 10.0.700 5


Before You Begin Advanced Business Process Management Course

Before You Begin

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

Audience

Specific audiences will benefit from this course.


System Administrator
IT/Technical Staff

Prerequisites

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
at EpicorCAM@epicor.com. 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.

6 Epicor ERP | 10.0.700


Advanced Business Process Management Course Before You Begin

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

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

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

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

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 > Emails and Forms 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: _____________________
Workshop - Create External Method
To complete this workshop, Microsoft Visual Studio 2010 or later must be installed and operation in your
environment.

Epicor ERP | 10.0.700 7


BPM and Service Oriented Architecture Advanced Business Process Management Course

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.

8 Epicor ERP | 10.0.700


Advanced Business Process Management Course How BPM Works

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.

Epicor ERP | 10.0.700 9


How BPM Works Advanced Business Process Management Course

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.

10 Epicor ERP | 10.0.700


Advanced Business Process Management Course How BPM Works

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.

Programming Actions

Program actions are actions defined in a programming language such as C# or Visual Basic .NET.
Actions play the role of event handlers which extend or replace the functionality of server-side Epicor application
business logic. A call to a business object's (BO) method triggers the execution of an action attached to that
method.
Thus, the action is a procedure which can be executed at the following times:
Before a method call.
In place of the standard method.
After a method call.
The following steps are required to define a program action:

1. Create an action template.

2. Develop action logic by editing the template in a development environment.

3. Deploy the action the application server.

4. Attach the action to a BO method.

BPM assists you in all of the above steps. However when you develop action logic (step 2), you should perform
most of this step in a development environment that can debug the code. BPM does not provide step by step
debugging or compiling functionality. Instead, you use BPM to attach conditions and actions to a BO method,
and these conditions and actions launch the code.
Important Epicor reserves the right to change the programming action API in future releases which may
require some effort to convert actions to comply with subsequent versions of BPM. This particularly applies
to the signatures of BO methods and the semantics of their parameters.

Epicor ERP | 10.0.700 11


How BPM Works Advanced Business Process Management Course

Custom Action

Several workshops that follow utilize examples based on C# syntax created using the Execute Custom Code
workflow item.
Use this program to attach a C# procedure to a method directive.

12 Epicor ERP | 10.0.700


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 doesn't wait for sending to complete; it's
started immediately when the directive executes.

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, Re, and so on. Many of the fields in the template
can contain values from the record or database.
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.0.700 13


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 companys email and then distributes it
through your companys 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 the 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.

5. Select the Update method.


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

14 Epicor ERP | 10.0.700


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


Use BPM to Send Email Advanced Business Process Management Course

14. In the Name field, enter CustomerID.

15. In the Table field, accept the default temporary table ttCustomer.

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

22. Select the Enabled check box.

23. Click Save.

24. Minimize Method Directives.

Test the BPM


Navigate to Customer Maintenance.
Menu Path: Sales Management > Order Management > Setup > Customer
Tip The CRM menu path is: Customer Relationship 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.

16 Epicor ERP | 10.0.700


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

8. For the Filter, select Unchanged records.

9. From the Fields list, 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 to return to the Method Directives.

15. Click Save.

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

Epicor ERP | 10.0.700 17


Use BPM to Send Email Advanced Business Process Management Course

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

4. Click Save and exit Method Directives.

18 Epicor ERP | 10.0.700


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 contacts address information with the customers 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.

Download Dashboard Definition


This workshop utilizes an updatable BAQ (EPIC06-UpdateCustContacts), which already exists in the Epicor
Demonstration Database and a dashboard named Customer Contact Update. Creating a dashboard is outside
the scope of this course, so you will first download the existing dashboard definition and import it into the Epicor
application.
Tip For more information on how to create dashboards, review the Introduction to the Dashboard and
Advanced Dashboards courses.

Important This task assumes you are working with the embedded version of this course, launch from the
Epicor ERP application.

1. Click the Dashboard Definiton link at the bottom of the page.

Epicor ERP | 10.0.700 19


Default Data To Updatable BAQ Records Advanced Business Process Management Course

2. Save the CustomerContactUpdate.zip file to your local machine, for example, to your Desktop.

3. Extract the zipped file.


Verify the CustomerContactUpdate.dbd dashboard definition extracts to your local.

Import Dashboard Definition


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

1. Verify the Developer mode is on.


If not, from the Tools menu, select Developer.

2. From the File menu, select Import Dashboard Definition.

3. Navigate to the Desktop and select CustomerContactUpdate.dbd.

4. Click Open.
The Customer Contact Dashboard Update dashboard displays.
Note When the XXX-CustContUpdate dashboard already exists in your environment, you will be
asked to rename the dashboard definition.

5. Click the Customer Contact Update sheet.

6. Click Refresh and verify the dashboard displays the list of customers and corresponding customer contacts.

7. Click Save.

Publish Dashboard Data


The first part of the process publishes the customer address information from the Customer Contact Update
dashboard.

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

2. From the Edit menu, select Properties.


The Dashboard Query Properties window displays.

3. Navigate to the Publish sheet.

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

20 Epicor ERP | 10.0.700


Advanced Business Process Management Course Default Data To Updatable BAQ Records

Column Name
Customer.State
Customer.Country
Customer.Zip

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

6. From the Publish Column, select Customer.Address1.

7. In the BPMDataColumn, select Character01.

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

Call Context Subscriber BPMDataColumn


Customer.City Character02
Customer.State Character03
Customer.Country Character04
Customer.Zip Character05

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

10. Click Save.

11. Minimize the dashboard.

Get the Updatable BAQ Methods


The next step is to locate the methods used by the updatable BAQ.
Navigate to Updatable BAQ Method Directives.
Menu Path: System Management > Business Process Management > Updatable BAQ Directives Maintenance
Important This program is not available in the Epicor Web Access.

1. Click the BAQ ID button.


The Updatable BAQ Search window displays.

2. In the BAQ ID Starting At field, enter EPIC06-U to narrow the search results.
The Search Results grid displays all the tables that match the search criteria.

3. Highlight the six options for EPIC06-UpdateCustContacts.

4. Click OK.
The Tree View displays the six updatable BAQ methods.

Epicor ERP | 10.0.700 21


Default Data To Updatable BAQ Records Advanced Business Process Management Course

New Post-Processing Directive


Add a directive to the updatable BAQ. In this example, the directive will default a new contacts 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. In the Tree View of the Updatable BAQ Method Directives program, select EPIC06-UpdateCust
Contacts.GetNew.

2. Click New and select New Post-Processing.

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

4. Click Design to launch the BPM Workflow Designer.


Example The following image displays the BPM workflow you will build throughout this workshop.

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.

22 Epicor ERP | 10.0.700


Advanced Business Process Management Course Default Data To Updatable BAQ Records

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 with
rule

5. Click the first specified link.


The Select Table Field(s) window displays.

6. From the Table drop-down list to select ttResults.

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 with rule

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 with rule

11. Click the specified link.


The Specify an expression window displays.

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

13. Double-click Character01.


The Editor field displays callContextBpmData.Character01.

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


The User Text now states:
set the ttResults.CustCnt_Address1 field of the added row to the callContex
tBpmData expression with rule
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 customers street address.

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

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

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

Epicor ERP | 10.0.700 23


Default Data To Updatable BAQ Records Advanced Business Process Management Course

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
Set Field 4 ttResults.ShipTo_Zip the added row callContextBpmData.Character05

18. Once complete, click Save and Exit to return to Updatable BAQ Method Directives.

19. Select the Enabled check box.

20. Click Save.

21. Minimize Updatable BAQ Method Directives.

Test the 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 a row.


The New button on the Standard toolbar becomes available.

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

24 Epicor ERP | 10.0.700


Advanced Business Process Management Course Default Data To Updatable BAQ Records

Disable Directive

1. Maximize Updatable BAQ Method Directives.

2. Verify the record in focus is XXX-Auto Populate Contact Address (where XXX are your initials).

3. Clear the Enabled check box.


The method directive is now disabled.

4. Click Save.

5. Exit Updatable BAQ Method Directives.

Epicor ERP | 10.0.700 25


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 C# code to set text properties.

Create the Method Directive


Navigate to Method Directives.
Menu Path: System Management > Business Process Management > Method Directives Maintenance
Important This program is not available in the 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 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).

26 Epicor ERP | 10.0.700


Advanced Business Process Management Course Set Text Properties

12. Select the Company Independent check box.

13. Select the Prevent Endless Loops check box.

14. Click Save.

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. This causes the custom C# code to run automatically with the method.

1. Click Design to launch the BPM Workflow Designer.

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

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

4. Click the Execute Custom Code workflow item.

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

6. Click the code link.


The Custom Code Action window displays.

7. Verify the Code sheet is selected.

8. Enter the code below:


/* Set CAPS */
foreach (var ttShipVia_iterator in (from ttShipVia_Row in ttShipVia
where string.Compare(ttShipVia_Row.RowM
od, "A", true) == 0
select ttShipVia_Row))
{
var ttShipVia_xRow = ttShipVia_iterator;
ttShipVia_xRow.ShipViaCode = ttShipVia_xRow.ShipViaCode.ToUpper();
}

Important When you copy and paste the above code, you may need to adjust it to make sure logical
statements are kept together on their respective line.

9. Click the Validate button to check the syntax.

10. In the Custom Code Action window, click OK.

11. In the Actions pane, verify the Action field displays the following:
synchronously execute custom /* Set CAPS */... record nothing

Epicor ERP | 10.0.700 27


Set Text Properties Advanced Business Process Management Course

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

13. Click Save and Exit to return to the Method Directives window.

14. Select the Enabled check box to activate the directive.

15. Click Save.

16. Minimize Method Directives.

Test the Directive


Navigate to Ship Via Maintenance.
Menu Path: Sales Management > Order Management > Setup > Ship Via
Tip The CRM menu path is: Customer Relationship 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 ShipVia Code changes to all CAPS

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.

28 Epicor ERP | 10.0.700


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 the Epicor Web Access.

1. From the New menu, select New Form.

2. Enter the following information:

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

Epicor ERP | 10.0.700 29


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.ShortChar01
Field Label First Name
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.ShortChar02
Field Label Last Name
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 the 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. Click Search.

30 Epicor ERP | 10.0.700


Advanced Business Process Management Course BPM Data Form Designer

5. Select GetNewUserFile and click OK.


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

6. In the Method Description field, enter BPM Form.

7. Click Save.

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. Select the Company Independent check box.

5. Select the Prevent Endless Loops check box.

6. Click Design to launch the BPM Workflow Designer.

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

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

9. Click the Call BPM Data Form workflow item.

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

11. Click named.


The Select BPM Data Form window displays.

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

13. Click OK.


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

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

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

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

17. Click Save and Exit to return to Method Directives.

Epicor ERP | 10.0.700 31


BPM Data Form Designer Advanced Business Process Management Course

18. Select the Enabled check box.

19. Click Save.

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. Select the Company Independent check box.

5. Select the Prevent Endless Loops check box.

6. Click Save.

7. Click Design to launch the BPM Workflow Designer.

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

9. Connect Start to Condition.

10. Click the Condition workflow item.

11. In the Condition pane click the New icon.

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


This directive has been enabled from the specified directive

13. Click specified.


The Select a primary directive to depend on window displays.

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

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

16. Click OK.

17. Remain in BPM Workflow Designer.

Show Informational Message


While you develop your BPM project, a good practice is to display the method and inputs in a message window
to confirm the BPM method activates and the input values are available when you expect them.
Important Because more than one table is available in this dataset, you must be careful to select the
correct table and field name.

32 Epicor ERP | 10.0.700


Advanced Business Process Management Course BPM Data Form Designer

1. In the workflow items tollbar, click the Show Message icon and drag it to the workflow pane of the
Designer, below the Condition item.

2. Click the Condition's True exit outbound connector (found on the left) and connect it to any of the Show
Message entry points.
This way, the BPM routes the workflow to the Show Message item when the condition statement resolves
to True.

3. Click the Show Message item.

4. In the Actions pane, the following statement displays:


Show informational message based on the designed template

5. Click designed to launch the Design Informational Message Template window.

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

7. In line 1 of the Text field, enter UserFile:GetNewUserFile - PostMsg1 (Method:Directive Type).


This is post-processing message #1.

8. In line 2 of the Text field, enter ttUserFile.RowMod = and then click the Insert button.

9. Select Field Query.

10. In the Name field, enter RowMod =.

11. In the Table field, select ttUserFile.

12. Select the Added records and Updated Records check boxes.

13. Select the check box next to RowMod.

14. Click OK.

15. In line 3 of the Text field, enter First Name = and then click the Insert button.

16. Select Call Context > callContextBpmData > ShortChar01.


Tip Scroll down to locate the ShortChar01 field.

17. In line 4 of the Text field, enter Last Name = and then click the Insert button.

18. Select Call Context > callContextBpmData > ShortChar02.


The completed text should display as follows:
UserFile:GetNewUserFile - PostMsg1 (Method:Directive Type)
ttUserFile.RowMod =<RowMod =/>
First Name = <callContextBpmData.ShortChar01/>
Last Name = <callContextBpmData.ShortChar02/>

19. In the Design Informational Message Template window, click OK.

20. Click Validate and verify BPM reports no errors.

Epicor ERP | 10.0.700 33


BPM Data Form Designer Advanced Business Process Management Course

21. Click Save and Exit to return to the Method Directives.

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
Important This program is not available in the Epicor Web Access.

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.

Add an Action
Add another action that takes the field values from the BPM form and populates the fields in User Maintenance.
You need to set the data in the temp table (tt) so entered data defaults into the form.
Maximize Method Directives.

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

2. Click Design to launch the BPM Workflow Designer.

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

4. Connect Show Message and Execute Custom Code workflow items.

5. Click the Execute Custom Code workflow item.

34 Epicor ERP | 10.0.700


Advanced Business Process Management Course BPM Data Form Designer

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

7. Click the code link.


The Custom Code Action window displays.

8. Verify the Code sheet is selected.

9. Enter the code below:


/* Set UserID and Name */
/* This takes the BPM data and creates the UserID and Name Fields */
foreach (var ttUserFile_iterator in (from ttUserFile_Row in ttUserFile
where string.Compare(ttUserFile_Row.RowMod, "a", true) == 0
select ttUserFile_Row))
{
var ttUserFile_xRow = ttUserFile_iterator;
ttUserFile_xRow.UserID =((string)this.callContextBpmData["ShortCha
r01"]).Substring(0, 1) + (string)this.callContextBpmData["ShortChar02"];
ttUserFile_xRow.Name = ((string)this.callContextBpmData["ShortChar
01"]) + " " + (string)this.callContextBpmData["ShortChar02"];
/* Now clear the BPM Data */
callContextBpmData["ShortChar01"] = "";
callContextBpmData["ShortChar02"] = "";
}
Important When you copy and paste the above code, you may need to adjust it to make sure logical
statements are kept together on their respective line.

10. Click the Validate button to check the syntax.

11. In the Custom Code Action window, click OK.

12. In the Actions pane, verify the Action field displays the following:
synchronously execute custom /* Set User ID and Name */... record nothing
Tip If you want to set one field to the exact contents of the BPM data, use the Set Field workflow
item. However in this example, you want to combine the first and last name information. Because
this requires some programming using specific syntax, use the Execute Custom Code item.

The you entered uses the first letter of the first name and last name to create the user ID. In the Name field,
the code puts the first and last name with a space between them.

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

14. Click Save and Exit to return to the Method Directives window.

Save the Directive

1. Verify the Enabled check box is selected.

2. Click Save.

3. Minimize Method Directives.

Epicor ERP | 10.0.700 35


BPM Data Form Designer Advanced Business Process Management Course

Test the Method Directive


Maximize User Account Maintenance.

1. From the New menu, select New User.


Notice your BPM Form displays.

2. Enter or verify your first and last name.

3. Click OK.
The PostMsg1 displays.
Your new BPM Form is working.
Tip After you make sure the BPM method is working in the production environment, delete the
informational message action from the method.

4. Click OK to close the message box.


Notice your BPM populates the UserID and Name fields.

5. Click the Delete button.

6. Exit User Account Maintenance.

Disable the Directive


Maximize Method Directives.

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

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

3. Click Save.

4. Exit Method Directives.

36 Epicor ERP | 10.0.700


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

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 the 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.0.700 37


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. Select the Company Independent check box.

5. Select the Prevent Endless Loops check box.

6. Click Design to launch the BPM Workflow Designer.

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

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

9. Click the Execute Custom Code workflow item.

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

11. Click the code link.


The Custom Code Action window displays.

12. Verify the Code sheet is selected.

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

38 Epicor ERP | 10.0.700


Advanced Business Process Management Course Data Directives

{
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.",
DuplicatedPOForCustomer.OrderNum));
}
Important When you copy and paste the above code, 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.

14. Click the Validate button to check the syntax.

15. In the Custom Code Action window, click OK.

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

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

18. Click Save and Exit to return to the Method Directives window.

19. Select the Enabled check box to activate the directive.

20. Click Save.

21. Minimize Method Directives.

Test Data Directive


Navigate to Sales Order Entry.

Epicor ERP | 10.0.700 39


Data Directives Advanced Business Process Management Course

Menu Path: Sales Management > Order Management > General Operations > Order Entry
Tip The CRM menu path is: Customer Relationship Management > Order Management > General
Operations > Order Entry

1. Click New.

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.

40 Epicor ERP | 10.0.700


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

Epicor ERP | 10.0.700 41


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

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 user guide. If you have any
questions about your custom code, refer to the various reference guides and training manuals available for the
programming languages.

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.
Important To successfully complete this workshop, Microsoft Visual Studio 2010 or later must be
installed and operational in your environment.

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
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 the Epicor Web Access.

42 Epicor ERP | 10.0.700


Advanced Business Process Management Course Using External Methods

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. The Method Arguments window displays. The signature for the current method displays within the grid.
Use this grid to examine the building blocks for the current method; this information is useful as you program
your action. Notice you cannot edit any of these fields.

4. The Order field displays the sequence of the method arguments. This indicates which argument runs before
the next argument, displaying the logic sequence of the selected method.

5. The Direction field indicates how the data flows through the argument. In this example, the direction is
INPUT, OUTPUT, and RETVAL.
INPUT - Indicates the arguments that pass data into the database.
OUTPUT - Indicates the arguments that push the data back to the client for display.
RETVAL - Defines the argument that determines the return value.

6. The BpmArgumentName field displays the name of the argument.

7. The Type field displays the .NET classification for each argument. This example displays the System.String,
System.Int32, System.Boolean, and Erp.Tablesets.ABCCodeListTableset types.

8. Remain in the Method Arguments window.

Epicor ERP | 10.0.700 43


Using External Methods Advanced Business Process Management Course

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.
You use this window to create a template for a custom external method using one the following action
component types:
.Net Assembly [C#] Select this option to create a template C# class with a single empty function. This
function matches the signature of the method you are customizing. You then write the custom code in
this function statement, build the C# assembly, and deploy it to the server. You can then select this
custom external method on a directive.
.Net Assembly [VB.NET] Select this option to create a template VB.NET class with a single empty
function. This function matches the signature of the method you are customizing. You then write the
custom code in this function statement, build the VB.NET assembly, and deploy it to the server. You can
then select this custom external method on a directive.
Epicor Service Connect Workflows Use this option to create the schemas required for an Epicor
Service Connect workflow. Through this Epicor application, you create integrated platforms for secure
data workflows between the Epicor application and third party applications.

2. In this example, select the .Net Assembly [C#] radio button to generate the template for the
Erp.ABCCode.GetList method.

3. The C# code shell for the custom action generates. It displays on the .NET Action Template - C# sheet.

4. Click Save.

5. The .Net destination folder window displays.

6. Navigate to the folder where you create your external assembles.

7. Click Save.
Your .cs file is now saved to this file location. You can now use this file to create your custom external
method. To do this, launch Visual Studio and create a C# project. You then include this file in this project
and then build it as a class library (.dll file). You then place this .dll file in an External Storage folder; this
folder is specified in the web.config file within the customizationSettings section. Typically its directory path
is the Server\Customization\External location

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.

44 Epicor ERP | 10.0.700


Advanced Business Process Management Course Using External Methods

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
tables 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 .
The below example uses Microsoft Visual Studio 2012.

2. Create an empty Class Library C# project.

3. Add your .cs file to the project. For example, AbcCode.GetList.cs.

Epicor ERP | 10.0.700 45


Using External Methods Advanced Business Process Management Course

4. Now add the references to the assembles from the Server\Assemblies and Server\Bin folders. This resolves
all the types used in the custom action, including the contract of the selected method.

5. 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. To accomplish
the desired the custom behavior, you write the following code:
namespace BpmCustomCode
{
public class MyABCCode
{
public void GetList(
ref System.String whereClause,
ref System.Int32 pageSize,
ref System.Int32 absolutePage,
ref System.Boolean morePages,
Erp.Tablesets.ABCCodeListTableset result)
{
result.ABCCodeList.RemoveAll(r => r.ABCCode.StartsWith("A"));
}
}
}

6. Build the project and deploy the custom method to the External Storage folder.
This folder is specified in the web.config file within the customizationSettings section. Typically its directory
path is the Server\Customization\External location.
Now that these external method .dll files are in the External Storage folder, you can deploy these methods
to Business Process Management. You do not need to restart Internet Information Services (IIS). When you
select the Invoke External Method action on a directive, the external method and its compiled assembly
display as options on the action.
Note If you replace an existing external method with a new version and your assembly is loaded into
memory, you will need to restart IIS. The external method will then update to the latest version.

46 Epicor ERP | 10.0.700


Advanced Business Process Management Course Using External Methods

Call External Method


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

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

2. Click New > New Pre-Processing.

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

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

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

6. Click and drag a connection from the Start item to the Invoke External Method item. When select the Invoke
External Method item, the Actions pane displays the Synchronously invoke specified Method from
external assembly action.

7. If you need, select the Synchronously option and change it to Asynchronously. This indicates the call is
queued and executed according to the schedule defined in the BPM Async Process program.

8. Next select the external method you have created. Click the external link.

9. The Add Reference window displays, showing the custom external methods you have created. Select the
custom external method from the list.

10. Now click the specified method link and select the GetList method.
At this stage, your workflow should look similar to the following:

11. Click the Save and Exit button.

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

13. Minimize Method Directives.

Epicor ERP | 10.0.700 47


Using External Methods Advanced Business Process Management Course

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. From the New menu, select New ABC Code.

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

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

4. The ABC Code Search window displays.

5. Click the Search button.

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

48 Epicor ERP | 10.0.700


Advanced Business Process Management Course Using External Methods

7. 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. Exit Method Directives.

Epicor ERP | 10.0.700 49


Manage Method Directives Advanced Business Process Management Course

Manage 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.
Create and select groups within Method Directives. The Pre, Base, and Post-Processing Detail sheets contain
a Group field.
Tip For the workshops in this course, you entered the group as XXX, where XXX were your initials.

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 the 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 the Epicor Web Access.

Directive Update
Use Directive Update to update the directive's properties and recompile the directives within a selected group.
Run this to apply primary options to all the group directives. For example, use this program to enable all the
directives in the group. You can also recompile the group directives to make them compatible with the current
version of the application.
Menu Path: System Management > Business Process Management > Directive Update
Important This program is not available in the Epicor Web Access.

Workshop - Export Directives

In this workshop, export your directive group.


Navigate to Directive Export.

50 Epicor ERP | 10.0.700


Advanced Business Process Management Course Manage Method Directives

Menu Path: System Management > Business Process Management > Directive Export
Important This program is not available in the 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 the Epicor Web Access.

1. Click the File Name button.

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.

Epicor ERP | 10.0.700 51


Manage Method Directives Advanced Business Process Management Course

8. In the Information message, click OK.


View the information about re-imported directives.

9. Exit Directive Import.

52 Epicor ERP | 10.0.700


Advanced Business Process Management Course Conclusion

Conclusion

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

Epicor ERP | 10.0.700 53


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.

Potrebbero piacerti anche