PXProjection – SQL Views using BQL

Hi Everyone, Occasionally I get question from partners related: Can we Join several tables with possibility to update them all? You know that Joined tables in Acumatica are read-only and you cannot update fields there Can we create/use SQL-like views in Acumatica? How can I join grouped (statistical) view to the DAC? The answer to all these questions is yes you can do it. But answer on how to do that is not so simple. Obviously the most strait forward way is to create an SQL view and generate a DAC based on it. But this way does not solve point number 1 – SQL view is read-only and does… Read more

Custom Image on Acumatica Form

Hi All, Want to share with you way how can you add Сustom Image on Acumatica form. To do that you can use PXImage control. In the ImageUrl you can add physical path to image on the file system. <px:PXImage runat=”server” ImageUrl =”~/Icons/login_logo.png”  /> This is static image and not linked with any data view or dac, so if you need to change images dynamically you have to write logic in the code behind file however it is not recommended way by Acumatica standards. Have a nice development!

Show and Hide Grids on the Fly

Hi Everyone, Sometimes you need to show user interface differently depend on parameters selected. Here I want to show you an approach where you can show different grids depend on parameters selected in filter. You may need different grids in the following cases: If have different data access classes (tables) to show. If you need to have different grids layout depend on parameters. If you  need to to have different columns configurations. So the plan is the following: Have 2 different DACs. We need it to have different caches, as viability settings are linked to cache. public class DetailsTableA : IBqlTable {       public abstract class fieldA: IBqlField { }         [PXDBString(1)]       [PXUIField(DisplayName = “Field A”)]    … Read more

Multi-Select Selector

Hi There, Want to share with you hidden way to add a multi-select Selector control to have better filters. There is a special UI Control px:PXMultiSelector that allows you to select multiple values in the same field. Values will be stored in the field with Semicolon Separator. For example in the field like shown above we will have following value: ACTUAL; BUDGET To add such control you need to do following: Define a selector on the DAC field. Please note that you should disable Validate value, as selector will try to search combined value in DB and fails with error. [PXSelector(typeof(Ledger.ledgerCD), ValidateValue = false)] Second step will be UI control definition.… Read more

Generate IN Receipt from the Code

Hi All, In my experience I have quite a lot of questions like – how to create a document on the fly. The answer is rather simple – we need to use the same objects as user interface and emulate user interface behavior. As the main object that contains a business logic and validation is Grpah, we need to create it from the code and use for calling actions and pushing data. INReceiptEntry graph = PXGraph.CreateInstance<INReceiptEntry>() To create a new object we can use PXCache. INRegister header = (INRegister)graph.CurrentDocument.Cache.CreateInstance(); Every container control form UI is linked with Data View that is linked with DACs and tables. As you may know… Read more

SQL In <> Operator in BQL

Hi There, Today want to show you example of amazing and very new BQL Operator – In<>. This operator was added just recently with Acumatica version 2017R2, so now you can pass there an array of values and Acumatica core will convert it to SQL IN ( … ) statement. Here is a code example: Object[] values = new String[] { “AC”, “IN” }; InventoryItem item = PXSelect<InventoryItem,        Where<InventoryItem.itemStatus, In<Required<InventoryItem.itemStatus>>>>.Select(Base, values); Console.WriteLine(item.Descr); This will be converted to following SQL Select * from InventoryItem InventoryItem Where InventoryItem.Status In (‘AC’, ‘IN’) Order by InventoryItem.InventoryCD Please note that In<> operator is available only with Required<> parameter and you need to pass array of possible values manually to Select(…) method parameters. Have… Read more

Remove base Attribute with Customization

Hi All In my previous article “Append and Replace of DACs Attributes” I have described how can you replace append attributed in DAC with customization. Today I would like to add one more useful attribute – PXRemoveBaseAttribute. This one can help you to just remove one specific attribute from base field and replace it with new one if needed. [PXDBString(32)] [PXDBDefault(“Test”)] [PXUIField(DisplayName = “Test” )] public String Field { get; set; } Example 1: public Extension : PXCacheExtension<DAC> {     [PXRemoveBaseAttribute(typeof(PXDefaulAttribute))]     public String Field { get; set; } } Example 2: public Extension : PXCacheExtension<DAC> {     [PXRemoveBaseAttribute(typeof(PXDefaulAttribute))]     [PXDBDefault(“New String”)]     public String Field… Read more

Difference between Acumatica ERP and Framework

Hi All, Previously I had quite a lot of questions about how to integrate development done on Acumatica Framework with Acumatica ERP. Usually them main reason of that question is misunderstanding of what is Acumatica Framework. Acumatica Framework (what you can download as separate installer from portal) is designed to develop product that is completely separated from Acumatica ERP. That is why there are less functions and no code integration with ERP. In case you are see benefits of using functions form Acumatica ERP (like segmented keys, numbering, accounts, subaccounts, customers/vendors, inventory items), it would be much better to start development on Acumatica ERP itself from the beginning, and do… Read more

DACs Inheritance and Caches

Hi All Want to speak today about DACs inheritance in Acumatica and some issues that it cause to development. As you know C#/.NET as OOP-oriented framework support inheritance of objects, but when in comes SQL and Database structure than there is no inheritance between tables. As a bonus I will explain why we need BAccount and BAccount2 DACs and what is the difference. Inheritance In Acumatica we want to leverage benefits of OOP to simplify references between objects, minimize database size required, ease of reporting and so on. As a result of that we have designed system in such way to support it: You can have parent DAC public class BAccount : IBqlTable { …… Read more

Multiple DataViews on the same Form

Hi All, If you didn’t know previously, in Acumatica has introduced new syntax of defining DataViews/Fields. Previously you have to create a new Form, assign DataView to form and than add there fields. But now you can use following construction: “DataMember.DataField” right in the DataField property. <px:PXSelector DataField=”BranchID” /> <px:PXCheckBox DataField=”DefLocation.IsRemitContactSameAsMain” /> <px:PXTextEdit DataField=”RemitAddress.AddressLine1″ /> <px:PXTextEdit DataField=”RemitAddress.AddressLine2″ /> Also, a DataMember can be specified as an attribute of a PXPanel, and it will be inherited by all internal controls. <px:PXPanel RenderStyle=”Simple” DataMember=”RemitContact” >     <px:PXMaskEdit ID=”edFax” runat=”server” DataField=”Fax” />     <px:PXMaskEdit ID=”edPhone1″ runat=”server” DataField=”Phone1″ /> </px:PXPanel> Have a nice development!

Database Mapped vs Virtual Fields

Hi All, Today want to share with you how Database vs Virtual fields are working in Acumatica. You may notice that some of the fields are linked to DB, some of them not.The difference is in the Attributes are used on it – PXDB<Type>Attribute is mapped on database field, PX<Type>Attribute is not. So from user standpoint it is just prefix “DB” or “”. In Acumatica there are many fields are mapped to database and most of them have a clone, that is not mapped. Here you can see list of most common attributes. Description Database Mapped Field Virtual Field String Value PXDBStringAttribute PXStringAttribute Byte Value PXDBByteAttribute PXByteAttribute Short Value PXDBShortAttribute… Read more

Redirecting to External Page from Button

Hi There, Want to share with you my experience with working with redirects from Acumatica. You may know that due to security issues and stability of software, redirect to external web site in the iFrame is forbidden in Acumatica. So every time when you use “PXRedirectToUrlException” for url like “http://acumatica.com” system will open url in separate window/tab. That is OK in mane cases, but sometimes you really need that functionality. One way to solve that issue is well described in a separate article – Redirect on Page Load But that one is applicable only if you want to have a menu item in Acumatica SiteMap. If you want to redirect… Read more

Actions and Primary View

Hi There, Today we are going to speak about Actions in Acumatica, as well known as Buttons. When you creating a button you basically just need to write a simple code snippet like here: #region Event Handlers public PXAction<PX.Objects.GL.Batch> MyButton;   [PXButton(CommitChanges = true)] [PXUIField(DisplayName = “My Button”)] protected void myButton() { } #endregion As soon as you add this button as extension and publish it, you will see button appeared on the screen. But from platform standpoint there is much more than button handler, let check how does it work: Action Data View – “public PXAction<Batch> MyButton;” PXAction is special version of Data View in Acumatica, that defines action name, as well as button handler name. But you may see… Read more

Sending Notification Template from Custom Code

Hi There, Today want to share with you how to send emails from Acumatica custom code based on Notification Templates. User scenario is very simple – lets assume we want to send an email from Acumatica that informs about contract, quote expiration or something else. But in the same time we want to keep activity linked to our document for the future reference. Basically, if we do that manually we need to create new Email activity, fill all details there, attach to entity and send it than, The obvious way to automate it is usage of Notification Templates. Notification templates are special type of emails, that can be combined dynamically… Read more

Conditionally Activate Extensions

Hi All, Today I want to share with the way how you can enable and disable extensions dynamically. You know that when you have published extension as a DLL or a Code file it will be automatically discovered by Acumatica Framework and used. However there is a hidden way to stop Acumatica from usage of that extension. Do do that you just need add static method IsActive() to your extension. public class GL_Batch_Ext : PXCacheExtension<PX.Objects.GL.Batch>   {           public static bool IsActive()       {         return false;       }   } Acumatica will automatically call that method by signature (you need to have correct name, public, static and return bool) and if it returns… Read more

Useful Web.Config Parameters

Hi All, Acumatica as standard ASP.NET application stores some configurations in web.config file. Some parameters can be really useful for users and developers. In this article i want to share with you parameters that really can help you. AutomationDebug (Default false) – An indicator of whether an information about the current automation step (state of a form of Acumatica ERP) is displayed on the form. If you set the value of the key to true, the text box with the current automation state is displayed on the Info area of a form of Acumatica ERP. Very useful parameter if you changing automation steps CheckCustomizationCompatibility (default True) – If the key… Read more

Append and Replace of DACs Attributes

Hi Everyone. Today want so share with you some ideas on how you can append, replace or merge attributes on standard Acumatica’s data access classes. Acumatica Framework attributes are used to add common business logic to the application components. Attributes implement business logic by subscribing to events. Each attribute class directly or indirectly derives from the PXEventSubscriberAttribute class. B Most attributes are added to data access class (DAC) field declarations. There are also attributes that are placed on a DAC declaration, view declarations in a business logic controller (BLC), and the BLC declaration itself. In general there are 4 places where you can define attributes: DAC attributes DAC fields. You… Read more

Client Events using JavaScript

Hi All, Today I want to share with you one way how you can add some client validations/calculation using JavaScript right in the browser with no accessing server data. In general i would suggest you to not do any complex calculations on client side and always use server for all data manipulations. However in some specific situations this approach may save a lot of processing time because client events may do calculations right in the browser. Also note that client logic will be available only for browser users and will not be triggered from web services API and Mobile application. The scenario that i want to do is quite simple… Read more

PXUIEnabled and PXUIRequired Attributes

Hi All, If you developing something on Acumatica xRP platform you know that changing of the UI fields visibility should be done through PXUIFieldAttribute on the RowSelected event. This works perfect on small screens with limited number of controls. But most of ERP screens are not really small. So most probably you already saw such types of code on the RowSelected in SOOrderEntry graph and many others. Not nice and really hard to support. Luckily now we have a different way to do it: PXUIEnabled – based on provided BQL conditions can automatically change UIFieldAttribute Enabled property. PXUIRequired – based on provided BQL condition can automatically change PXDefaultAttribute PersistingCheck property.… Read more

Getting started with Acumatica xRP Platform

Hi All, Sometimes I get a questions like this: How to start development with Acumatica xRP platform? How complex is it? Where we can get some guidance? So here I want to summarize all thoughts that I have about it. I would select these steps that i would recommend you to do: Ensure Pre-Requisites Get Acumatica Prepare Development Environment Learn Acumatica xRP Platform Do Development Communicate & Support Lets go though each of these steps in details under the cut. Knowledge Pre-Requisites To be able to do development you need to have a knowledge of technology and programming language used in Acumatica. This knowledge outside of Acumatica training course: Proficiency… Read more