BPM Condition based on AppServer or Database

Is there a way to check in a BPM if I’m using my Live system or my Dev system? I don’t see one in callContextClient which is where I might expect to find it. An example would be a BPM sending an email on a certain event, but when we copy Production over to our Dev environment we obviously don’t want those emails to send.

Currently we just have a list of things to disable, but am wondering if there’s a way to save a step and just require the BPM to be in Live to fire the email. Thanks!

Brendan, you could have it check something else that you always configure as soon as you create the Test environment. For example, we always change our company name. Unfortunately, if you forget whatever that thing is, then you’ve forgotten to disable the emails as well.

2 Likes

I usually place this code and different variants of it at the beginning of my BPM’s

string appserv = “”;
if(Session != null && Session.AppServerURL != null)
{
appserv = Session.AppServerURL.ToString();
int index = appserv.ToUpper().IndexOf(“TEST”);
if (index != -1)
{
// it found the TEST version you could set a variable…
}
// you can continue…with other versions…

}

So you could use the condition where this code returns True if live, and false otherwise…
if true, fires the email…

Hope it helps…

4 Likes

That is basically exactly what I was looking for. Thanks!

I realize this is old, but I’ve been searching for this answer for a few days and found nothing:

I have a UBAQ directive getting called by a scheduled task in Epicor’s System Agent. It appears that Session is null in this case. Is there a way to get the AppServerURL through another object other than Session?