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 :




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.



How to use F-BQL view instead of PXSelect

Hello everybody,

today I want to leave a short note on how to use F-BQL version of PXSelect in Acumatica.

In past it was common to have this line of code in your graph:

public PXSelect<Student1> Students;

In new F-BQL introduced new construction, SeleftFrom. Proper way of using it is this:

public SelectFrom<Student2>.View Students;

Take notice of suffix .View. Without that suffix you'll not get proper F-BQL view. And Acuminator will give you this warning:

So if to summarize, don't forget to add suffix .View

How to download DAC schema browser

Hello everybody,

here is just short post on how to download DAC Schema browser which I recently opensourced.

You'll need two steps:

1. Navigate in your browser to link https://github.com/YuriyZaletskyy/DacSchemaBrowser 2. Click on Star as displayed on screenshot (this is optional step):

       4. Right mouse click AcumaticaTablesFixed19x100x0122.zip

       5. Save customization wherever you wish

       6. Publish on your local instance

That particular file is intended for Acumatica version 2019 R1 build 0122, but it should work on higher versions as well. Later on I'll add lower versions as well.

How to get list of all Acumatica tables

Hello everybody,

today I want to share single line of code, which I found recently while digging Acumatica source code with reflector. Sometime you may need to know if there is some or antoher Acumatica table available. For example if you create some customization plugin. How to find out if there is some table? You can use following line of code for this purpose:

using PX.Api.Soap.Screen;

............

var acumaticaTables = ServiceManager.Tables;

Variable acumaticaTables will have a list of Acumatica tables.

Configuration Error for Acumatica T100 training

Hello everybody,

once upon a time Acumatica requires for certified developers to pass over certification again. 

As obedient person I decided to install T100 sample application over Acumatica Framework Configuration ( don't mix with Acumatica ERP Configuration ). Then I navigated to just installed application, and here is what I've seen:

Server Error in '/T100a' Application.


Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: The connection string name is missing for the MySqlSiteMapProvider

Source Error:

Line 283:    <siteMap>
Line 284:      <providers>
Line 285:        <add name="MySqlSiteMapProvider" type="MySql.Web.SiteMap.MySqlSiteMapProvider, MySql.Web, Version=8.0.13.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/" />
Line 286:      </providers>
Line 287:    </siteMap>

Source File: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config    Line: 285


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.3282.0

 

 

Very puzzling honestly speaking. You've just installed something, and right from the start it doesn't work. 

After some Research I have found, that following some additions should be added to node siteMap section providers:

			<siteMap enabled="true" defaultProvider="PXDatabaseSiteMapProvider">
				<providers>
			            <remove name="MySqlSiteMapProvider" /> <!-- add this line --> 
			            <remove name="PXWikiProvider" />

 

After those additions I was able to open Training sample T100.

How to call action Cancel in Acumatica

Hello everybody,

Today I want to leave a short notice on how to call Cancel button of Acumatica from inside C# code:

graph.Clear();

That is it, Clear method is binded to button Cancel in Acumatica. Besides that Clear method will reload current data record from database and rolls back changes of Cache objects.

PXUIRequired attribute usage in Acumatica

Hello everybody,

today I want to say a bit more about usage of attribute PXUIRequired as previous article on my blog wasn't very easy to follow by some of my readers.

Take a look on presented code sample:

public class sOOrderType : Constant<string>
{
	public const string SOOrderType = "SO";
	public sOOrderType() : base(SOOrderType)
	{	
	}
}
 
public class SOOrderExt : PXCacheExtension<SOOrder>
{
	[PXMergeAttributes(Method = MergeMethod.Append)]
	[PXDefault]
	[PXUIRequired(typeof(Where<SOOrder.orderTypeEqual<sOOrderType>>))]
	public virtual string CustomerOrderNbr { getset; }
}

As you can see, besides attribute PXUIRequired it has declaration of constant value "SO". With that declaration before class you may get validation only for SO Order type "SO".

And now as you see on screenshot, field Customer Order got it's star. Take notice that color of that star is also differnet, it become red.

One more point which I want to underline, attribute PXUIRequired will work in connection with PXDefault attriubute. Without PXDefault attribute you'll get another error message, so as as summary, use PXUIRequired attribute with PXDefault.