Skip to main content

I am trying to retrieve the Acumatica Instance ID from within code as part of a licensing validation/restriction type verification. This would be for version 22R1 and newer.

 

Thanks !!

 

If Acumatica Instance ID is installation ID, then this example may help you:

using PX.Data;
using PX.Licensing;

namespace PX.Objects.SO
{
public class SOOrderEntryExt : PXGraphExtension<SOOrderEntry>
{
[InjectDependency]
private ILicensing _licensing { get; set; }

protected void _(Events.RowSelected<SOOrder> e)
{
throw new PXException(_licensing.PrettyInstallationId);
}
}
}

 


Hi @rmillman33  I have an update from Acumatica support team that it is not recommended to validate the license using the Installation ID, there will be a challenges using this, hence we also modifying the License code as suggested by Acumatica. 

I request you check with Acumatica team before you working on this.


Hi @rmillman33,

As Naveen mentioned, using InstallationID and some other values that looks constant it questionable, and even forbidden by the Certification Guideline. The reason for those values might change, the InstallationID, for example is calculated on the start of the Application based on environment settings. So building business logic that would rely on that value is insufficient as might break just due to some server maintenance. 

I can suggest using Cloud Tenant ID instead - it is the GUID you can see on the Tenant screen, which is unique per Tenant, being assigned once and never changed (at least by Acumatica product itself).

Beside of extended level you can license (per Tenant rather per instance), there is a quite DI based interface that will allow you to get current Cloud tenant ID from anywhere in your code. See example below:

using PX.CloudServices.Tenants;
using PX.Data;

namespace PX.Objects.AR
{
public class ARPaymentEntry_Extension : PXGraphExtension<PX.Objects.AR.ARPaymentEntry>
{
InjectDependency]
private ICloudTenantService _cloudTenantService { get; set; }

public PXAction<PX.Objects.AR.ARPayment> Test;

PXButton(CommitChanges = true)]
PXUIField(DisplayName = "test")]
protected void test()
{
Base.Document.Ask(_cloudTenantService.TenantId.ToString(), MessageButtons.OK);
}
}
}




 
 


Reply