BPM Condition phrases

I am trying to create a BPM prevent most users from changing the description for a specific group of Part Masters.

  1. The PartNum should be of a “three-dash-three” format ~ 123-456
  2. The PartDescription field has been changed
  3. The user is not a member of a specific group

if all conditions are met then raise an exception.

My problem is how to fullfil step 1. I have tried both of the following C# expresions with no success:

-” (three underscores a dash and three underscores)


Any suggestions would be appreciated.

I was able to get it to work by slightly changing your second attempt to:


But maybe this is exactly what you tried? I noticed that my “\” in front of the “-” was removed in the post until I formatted it as code. Html problems.’’

Here’s the full expression I set in an argument/variable widget:

Regex.IsMatch(ttPartRow.PartNum, @"^\d{3}\-\d{3}$")

The @ before the string is also important. (It keeps the string from converting the escape sequences)

1 Like

FYI - I use https://regex101.com/ or https://www.regextester.com/ (or any of the multitude available) to test a number of variations of sample data against an expression. It’s an easy way to tell if you’re expression is solid.

1 Like

Sorry all, the exact contents of the strings I tried appears to have been displayed incorrectly (my bad).

So, a couple of screenshots to supply the correct info:

I think you’ll need to put them in a regex call now (unless you’re doing that in another expression window).

Here’s how I was able to get it to work:

Add Usings/Refs

Create bool variable, set to regex.match expression

Then you can use that variable in a condition to raise the exception


(true = match , flase = no match)

1 Like


Could you give me more detail - I have little knowledge of .NET languages and formatiing/layout


Added a few screenshots to my previous post :+1:

I think I am using an older version of E10 the screens appear different (10.1.400.38)

Also your screenshots show “In-Transaction” - I am using “Pre-Processing” ~ does this matter ?

I have created the set Argument/variable Task, created the variable “Regex” but when I try to add the C# expression it thows an error:

The error mentions a using directive which I can see in your screenshots bit do not know where it is in my Epicor version

Gotcha. In-Trans v Pre-processing shouldn’t matter in this case. I was just testing mine in a data directive (rather than method).

First, change your variable name from “Regex” to “regex” or “regexTest”. Regex with a capital R is the class you’ll use that has that isMatch method, and you will confuse things naming the variable the same thing (sorry for the confusion).

I’m not familiar with your version (your profile says 10.2.300 btw), but you should be able to add the "using"s via a custom code block. You may need to connect the empty code block you add these usings to (and put in the beginning after the start widget), but I’m not sure.

If you don’t have access to the custom code widget, you’ll need the “BPM Advanced User” checkbox checked in the user account security maintenance module to get it.

have you tried LIKE [0-9][0-9][0-9]-[0-9][0-9][0-9] ?


matches with "[0-9][0-9][0-9]-[0-9][0-9][0-9]" as the expression

Here it is in a working DD



For my test, it was looking for cc-nnnn where c is a Char A-Z, and n is a number from 0-9


Much easier…nice one!

I tried the option Calvin suggested, as it is the “easier” one, but this did not work either. However, me being cautious I decided to try the same logic in the TRAINING database:

RESULT ~ it works as expected

I will double check all the other suggestions in the same database and post the results.

Now I have to raise a support ticket to discover why it does not work in our LIVE environment. I will also update this information to the discussion when it is available.

Thanks for all your help up to now.

@Asz0ka @jerrygreenaway

Try this, add this formula to your variable widget


1 Like

To be clear @A.Baeisa’s solution requires your variable to be of type Bool

@A.Baeisa - Does that require a using statement, or does spelling the whole thing out
System.Text.Re...ions.Regex.IsMatch do the trick?

Hi @ckrusen,
yes of course my variable is defined as boolean because the output from this function is boolean i.e. true or false, and this apply to @Asz0ka solution as well, i just confirmed that this function/method will do the job, i have tested it within Epicor and outside C#/.NET running app, the only different is the backslash position and number. image
also the function does not required to add any using to the class it is already defined within the std class called subroutine (code library), at least in my version.


Thanks all for the contrributions, I now has enough information to resolve the issue:

The following grid shows which of the strings work

The reason that the strings would not work in the LIVE database is so simple I cannot believe I missed it:
The condition phrase must use the “matches” option.
The “equal to” option does NOT work.

So in summary a screenshot to show all relevant info:

1 Like

"^\d{3}\-\d{3}$" would work if preceded by an '@' for a complete expression of:


The '@' at the front a a string constant instructs it to NOT escape the sequence


The last two differ by whether it is an exact match.

The second to last one matches 123-456 and 123-456-789, TEST 123-456, 123-456X
The last one only matches 123-456