Get AppserverURL in EFx


I have an Epicor function that I can fire from a classic customization or a REST call from a handheld device.

I need to grab the app server name to get access to an “out” folder to export a file to.

When I run the function from the classic customization I get the appserver name, but from the REST call I get the IP address.

The IP address version won’t let me create the file in my out folder.

Here’s the relevant code:

// build and export heat file
var context = (Erp.ErpContext)Ice.Services.ContextFactory.CreateContext();
var erpContext = new Erp.Internal.Lib.CCredChk(context); // used this library/assembly only for erpContext

// get server url
url = this.Session.AppServerURL;

Ring a bell?



Update: I tried getting the URL from an updatable query. I get the appserver name when I test in the BAQ designer, but the IP address when calling it from a function. Hmm.

Perhaps you can use what Epicor uses internally, one of the following:

It may be more reliable because the AppServerURL could be an IP Address.