How to work with unbounded DAC in Acumatica

Hi everybody,

today I want to leave a short note on how to deal with Unbounded DAC classes in Acumatica. Unbounded in other words means DACs that doesn't have dirrect persising target in database.

For Unbounded DAC classes to work like this, two steps are needed:

  1. Add attribue [PXVirtualDAC] to PXSelect or PXSelect.....
  2. Add attribute PXVirtual over your DAC class declaration

With those two details you'll have complete independence of your classes from Database.

How to restore snapshot of Acumatica

Hello everybody,

today I want to leave a post on how to restore Acumatica snapshots with help of Acumatica Wizard.

Before creating snapshot you may need to switch Acumatica to maintenance mode. Below are the steps for achieveing it:

1. Go to System --> Management --> Apply Updates, click on the button "Schedule Lockout" and specify the reason for lockout
2. Don't forget to remove the lockout after you'll restore Snapshot.

 

 

Steps are the following:

1. Create a snapshot of the tenant you wish to back up

 

2. Export that snapshot (I recoment  xml format).

3. In the folder where the corresponding Acumatica Wizard is installed (usually c:\program files\Acumatica ERP\), find the folder called  \Database\Data, where there are individual folders with snapshot data.

4. Create a new folder for your new snapshot

5. Extract the contents of the .zip exported snapshot into the new folder you created

6. Run the Acumatica Wizard

7. Choose the "Perform Application Maintenance" option

 8. Select the site into which you wish to import this data

9. Choose the "Tenant Maintenance" option or "Company Maintenance":

10. Click on the "Advanced Settings" button at the bottom

11. Click on the "Insert Data" option next to the tenant where the data should be imported and select the new folder/snapshot you added in step #4 above:

13. Proceed through the wizard as normal. When the install process is complete you should have a tenant with restored data.

 

How to enable some control in Acumatica

Hello everybody,

today I want to leave a short note for the following situation:

Imagine that you need to enable some control in Acumatica ( for example Mark for PO ) on page Sales orders ( SO301000 ).

As usually for enabling control there are two ways:

  1. RowSelected
  2. Automation steps.

Recently I found third option, when neither 1 nor 2 did work. After spending some time I found third option: Cache has property AllowUpdate. After I've set it to true, I was able to modify lines in Document details. 

In your code it may look like this:

protected void SOLine_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected del)
{
        if (del != null)
              del(cache, e);
        SOLine row = (SOLine)e.Row;
        if (row == nullreturn;
        Base.Transactions.Cache.AllowUpdate = true;
        PXUIFieldAttribute.SetEnabled<SOLine.pOCreate>(cache, row, true);
        PXUIFieldAttribute.SetEnabled<SOLine.shipDate>(cache, row, true);
}

you still may need Row_Selected event handler, but not forget to add AllowUpdate = true.

 

New syntax of SetVisibility method in Acumatica

Hello everybody,

today I want to write a few words about changes of PXUIFieldAttribute.SetVisibility method. 

In the past, if you wanted to turn on some column, you could write in RowSelected event something like this:

          PXUIFieldAttribute.SetVisibility<APRegister.finPeriodID>(Documents.Cache, nulltrue);

If you want to turn it off, then this:

PXUIFieldAttribute.SetVisibility<APRegister.finPeriodID>(Documents.Cache, nullfalse);

But for quite a long time ( even in 2017 version ), Acumatica team introduced PXUIVisibility enum. In code it looks like this:

[Flags]
public enum PXUIVisibility
{
  Undefined = 0,
  Invisible = 1,
  Visible = 3,
  SelectorVisible = 7,
  Dynamic = 9,
  Service = 19,
  HiddenByAccessRights = 33,
}

For now I can comment on Visible and InVisible which correspond to false and true in the past implemtations. And in future posts I'll describe other selectors. 

How to change all emails in Acumatica

Hello everybody,

today I want to leave a post on how to change all emails, which are contained in Acumatica. For this purpose you may use script below:

UPDATE contact SET    email = email + '.ts'

UPDATE socontact SET    email = email + '.ts'

UPDATE apcontact SET    email = email + '.ts'

UPDATE pocontact SET    email = email + '.ts'

UPDATE crcontact SET    email = email + '.ts'

UPDATE arcontact SET    email = email + '.ts'

UPDATE fscontact SET    email = email + '.ts'

UPDATE crcasecontacts SET    email = email + '.ts'

UPDATE crcontact SET    email = email + '.ts'

UPDATE pmcontact SET    email = email + '.ts' 

If you wonder, what can be the usage of such SQL, consider following scenario. You've restoed from back up some database. And you need to see if Automation schedules work fine. How can you do it without deletion of all of them and spamming of all customers of your customer? The only way would be updating emails in your database.

If you know any other table that contains e-mails which I've missed, let me know, I'll update this SQL script accordingly.

Required of BQL in FBQL of Acumatica

Hello everybody,

today I want to describe how analogue to Required works in Acumatica Framework.

For example, in the past ( before 2019 R1 ) you may read something from Acumatica with help of Required:

var contact = PXSelect<ContactWhere<Contact.displayNameIsNotNullAnd<Contact.displayName
Contains<Required<Contact.displayName>>>>>.SelectWindowed(graph, startIdx, 1, ' ').First();

Now, you can use @P.AsString, as shown on code sample below:

var contact = SelectFrom<Contact>.Where<Contact.displayName.IsNotNull.And<Contact.displayName.
Contains<@P.AsString>>>.View.SelectWindowed(graph, startIdx, 1, ' ').First();

Conclusion

Also take a note, that FBQL looks a bit simpler then BQL which has plenty of <<<>>>>

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 :

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 :