What DB am I in during Configuration?

How can I tell what DB I am connected to while running the Configurator?
I need to know whether I am in the “Live” or “Test” DB during Configurator execution. Is there a way to tell? I don’t see any Context values or anything that would tell me that.

In the On Page Load you can use:

string Environment = Session.AppServerURL;

Depending on the version you could add a server side UD method to read SysCompany.IsLive to also validate.

Session does not seem to be recognized as an object. Am I missing something?
Oh. On Load. Got it. Thanks!

Make sure you are in the On Page Load event. This will not work in other events.

image

As “universal” indicator that shows in all forms, I set the default theme in my test environment to one with lime green toolbar backgrounds.

You can’t miss it, and no customization required. Just have to remeber to set the default theme each time you copy the live DB over the Test one.

Here’s an example (with a theme file link too)

And those colors appear on all forms (at least ones with toolbars), not just the main window of Classic mode.

I think this depends on the use case and sometimes a single line of code is worth a thousand do not forget to do this moments on refreshes - at least for this example. I do like the use of themes in general. You could script the theme but then you are customizing, just in different way and better lock those users down so they cannot change it. If the use case is using the Prod vs. Test for larger things like URL for Test vs. Prod APIs or anything programmatic I don’t believe the theme is going to help you much. I also don’t believe the actual configurator screens follow the theme - which is another problem if you have it full screen and forget. You can see below, the theme is set for forms behind the actual configurator screen but nothing on the actual screen itself.

But yes, themes are only good for getting a users attention. Anything that is automated should use code to determine the environment.

Is current theme in the session object?

I don’t believe it is, but know where you are going with that and not a bad idea.

I’m not familiar with the Specify an Expression - Input Property On Page Load… I’m hoping to use a BPM that makes decisions based on what environment we are in. Can this approach be used in a BPM, if so where can I read about how to Specify and Expression?

I use this in email subject:

string EnvSubject = string.Empty;

if(this.Session.AppServerURL.Contains("Test"))
{
      lEnvSubject = " from Epicor Test System!!!" ;
}
else if(this.Session.AppServerURL.Contains("Pilot"))
{
      lEnvSubject = " from Epicor Pilot System!!!" ;
}
else if(this.Session.AppServerURL.Contains("Train"))
{
      lEnvSubject = " from Epicor Training System!!!" ;
}
else lEnvSubject = "" ;
1 Like

Interesting. If I right click on the custom code window I get various variables that I can see, but Session isn’t there. It also doesn’t break down what the sub-fields of things like callContextClient are. If I right click in an e-mail template it’s a bit better, as I can see all the fields available in callContextClient, and “ds” is accessible under Field Query or Table Query. But I don’t see the “Session” variable anywhere. It’s really helpful to be able to browse to see what fields are available, is there some place I can see Session?

use this.Session.AppserverURL

Oh, “Session.AppserverURL” works fine by itself, I just don’t see any indication that it exists from the right click menu like I do for callContextClient fields or the parameters to the BPM. I don’t see “this” either.

See the recent topic on Intellisense. It mentions the keystrokes required to show the properties and methods for an object.

1 Like