BPM that checks to see if Process is running

I have a Data Directive in E9 that checks to see if a process is running (specifically Capture Cost WIP). The code in E9 to check this:

if index( program-name(i), "CaptureCOSWIP.p" ) > 0 then do:
    calledFromCOSWIP = true.
    leave.

After running this through the code converter, I get this:

if ((stackTrace.GetFrame(i - 1).GetMethod().Name.IndexOf("CaptureCOSWIP.p") + 1) > 0)
{
    calledFromCOSWIP = true;
    break;
}

The problem is the “CaptureCOSWIP.p” portion. I assume the .p stands for progress file? Since it was scrapped in E10, I’m wondering what this is called? Is it the DLL I see in Menu Maint, or is it something different? Basically, this Data directive needs to execute if it was not called to action by the Capture Cost WIP process. Anyone ran into this before in 10?

I’ll keep you posted, but i think I can simply put a MessageBox in to show me the CallingMethod by using:

stackTrace.GetFrame(1).GetMethod().Name

I’ll post back with a result if this helps anyone else.

1 Like

It looks like the code above does give you the name of the method that executes. I’m looking for processes in Epicor that are currently running at the time the BPM fires. So it looks like the code above doesn’t work for that. Back to the drawing board.

and how would you like to trigger this BPM ?

It’s a data directive in POHeader. Basically, we want some things to happen in POHeader (defaults etc.), but only if the CaptureCOSWIP process is not running.

If you can figure out the actual process name, then you can use this widget in the Data Directive to decide if your logic needs run. Personally, to figure this out, I have found it easiest to (IN A TEST SYSTEM) push the value of this callContextClient into a comment field, and then run the process. Once you figure out the process name that shows in the field, then create a condition to filter based on the value. image

if you know where to trigger your BPM, why do not you try to add custom code to go through the SysTask table find your process and validate process status Pending or Active

it is worth mentioning that you need check your -Live- system performance after apply it.

^^^This is it! :slight_smile: