Different methods of PXInstanceHelper class in Acumatica

Hello everybody,

today I want to document one important class in Acumatica: PXInstanceHelper.

I have found it long time ago, but finally time arrived to show how it works and what features it has. So, PXInstanceHelper include such methods:

  1. Method AppDataFolder.

In code it looks like this:

var result = PXInstanceHelper.AppDataFolder;

Screenshot of it's execution may give you additional hint of what it does:

This method returns physical path to folder App_Data inside of Acumatica instance. As you can see from the screenshot, on my dev machine App_Data folder lives at

C:\Program Files\AcumaticaERP\InstanceHelperDB\App_Data

2. Method CurrentCompany.

In code looks like this:

var result = PXInstanceHelper.CurrentCompany;

Screenshot of it's execution :

This method return Company ID, in my case are "2", it has type int.

3. Method CurrentInstanceType.

In code looks like this:

var result = PXInstanceHelper.CurrentInstanceType;

Screenshot of it's execution :

As you can see that CurrentInstanceType method return the type of our Acumatica instance, in my case are "Erp". Among other types it may return portal.

4. Method DatabaseId.

In code looks like this:

var result = PXInstanceHelper.DatabaseId;

Screenshot of it's execution :



result = 0 mean, that I use in my project one database. But if you in MultiDbMode, than DatabaseId method will return HashCode for you.

5. Method DatabaseName.

In code looks like this:

var result = PXInstanceHelper.DatabaseName;

Screenshot of it's execution :



So, DatabaseName method gets database name of current project.

6. Method HostName.

In code looks like this:

var result = PXInstanceHelper.HostName;

Screenshot of it's execution :



By using this method you can recieve name your server.

7. Method IISVersion.

In code looks like this:

var result = PXInstanceHelper.HostName;

Screenshot of it's execution :



As expected, this method returns the IIS version. As outcome if you need to make something, based on specific IIS version, you know what to use.

8. Method IPAddress.

In code looks like this:

var result = PXInstanceHelper.IPAddress;

Screenshot of it's execution :


This functionality may be needed for cases if you have kind of IP address binging, or if you have Acumatica cluster.


9. Method Impersonation.

In code looks like this:

var result = PXInstanceHelper.Impersonation;

Screenshot of it's execution :



If you want to run under a specific user account, this property may be beneficial for you.

10. Method InstanceID.

In code looks like this:

var result = PXInstanceHelper.InstanceID;

Screenshot of it's execution :
  

After the user has selected the values of the parameters of the report and clicked the Run Report button on the form toolbar
of the report form, the webpage sends the GET request to PX.ReportViewer.axd on the server with the ID of the WebReport instance
in the session (which was created when the report was launched). By InstanceID method you can retrive this ID.

Summary

Class PXInstanceHelper has plenty of properties, which give you information about your Acumatica system. You sometime may need it in order to make conclusions in the code.

No Comments

Add a Comment