Sometimes people want a BPM to only run when certain conditions are happening. I saw this a question on another post, and I thought I would pull out this question and answer into a more generic post.
Did you know that there are “Call Context” fields available to check? What can you find out from the current call context?
- The current process that the user is running
- The menu option that they ran it from
- the user who is trying to run this
- the type of client
- the Company or Plant that the user is currently running from.
- EVEN the CUSTOMIZATION ID that is being run.
(and a few more).
Why would I need this? Well, I have seen situations where the BPM only needed to be run if we were actually adding an order from the order entry process, but when the order was coming in from the Web (ecc) we didn’t want to run the process… (or actually, it might have been the other way around).
But sometimes people ask "well, how do I know what to put in my Condition in the BPM?. The easiest and best answer is to use the BPM to tell you first, then create the condition.
-
start by making a very simple BPM against the business object you are going to run. In my case, i was making the BPM on ABCCode.Update in the PRE processing method.
-
I created a Message Display box, and displayed all the context fields I was interested in possibly looking at.
-
I enabled the BPM, and then went to ABC Code Entry and modified the record. When I saved it, the following popped up:
-
NOW, i can go back to the BPM, remove the display, and add a simple condition to the BPM that checks for the condition I want. In this case, I want to only run this if the ProcessID is IMMT1005… but I could check for only running my BPM if i am in a certain customization, or on a certain client type: