Saving Entry from Custom Button

Hey! It’s a pretty common situation when you need to call the Save action from your button. You could use it in graph extension or directly in the base graph. We will use the extension as the example but the code almost the same for the pure graph. There are two requirements: A button should use the IEnumerable version of the method, not void. A method without the return brokes navigation after saving. A user could get blanked screen when saving a new document. A method should be decorated with PXButton attribute with CommitChanges = true property, otherwise, the Save button could stay in enabled status after saving. Not tested with CommitChanges in… Read more

Remove Action Menu from Actions Drop-down

Hi All, Show example for you today – how to remove action from menu based on example of ChangeID function in CustomerMaint graph. Problem If you take VendorMaint and try to find who ChangeID is declared there you will be able to find following code: So you can see here that ChangeID button is added as a menu to the Action button. This works pretty well accordingly to example with adding sub-menu actions here. Now the question – what if we need to remove or hide this action? We can’t use automation steps as they cannot make button invisible. We cannot use PXUIFieldAttribute on ChangeID as this button is already… Read more

Grids Master-Detail Relationship

Hi Everyone, Sometimes you need to have a screen with 2 grids that depend on each other. When you change line in one grid, it should refresh records in another. In this case you need to establish Grids Master-Detail relationship. In general master-detail relationship for grids is almost the same as for form-grid. You can read more about it in T200 Framework Fundamentials Training Guide, Example 2.2, Setting Up the Master-Detail Relationship Between DataAs a summary from the training, we need to do 3 points Put PXDBDefault attributes in child DAC to auto-initialize dependent keys. Put PXParent attribute in child DAC to allow cascade deletion and few other functions. Use… Read more

Primary & Foreign Keys

Hi Everyone, Acumatica is a advanced ERP system. And when we speak about ERP it is not only about data input, it also about how to store, retrieve and analyze data we have. Because of this we have very connected tables in Acumatica databas where almost every 3rd-4th column is a foreign key to other record. This helps a lot with data analyses.But how to organize keys better for usage, faster for search and smaller for database storage? Primary/Foreign Keys Definition In general we have only 2 ways to define and organize keys: Natural Keys and Surrogate Keys. Each way has own benefits. Natural keys (Code, CD)A natural key is… Read more

Concurrent Update

HI All, With current web applications architecture it is complicated to track what users are doing on browser side: are they still online or on the way to take a cup of coffee? Will they save a record or just checking it?We can’t just lock records in the Web Application every time when someone have opened it for editing.So here we have 2 main problems: You don’t know who and when will save it You don’t know if user still online or not In Acumatica we have designed the platform in the way to not depend on user behavior. But we still have 2 different ways to manage concurrent update… Read more

Dynamic Drop-Down Control

Hi Everyone, Usually Acumatica Drop-Down controls have fixed lists of values. Of course you can use PXStringListAttribute.SetList<…>(…) method do change list of values dynamically, but how to make it more handy. The way I recommend you is to create an attribute that can encapsulate all the field related logic, so to use it you can just put the attribute on the proper place. So the plan: Create an attribute that will be inherited from PXStringList and provide the values Create IPrefetchable class that can be automatically load all possible list from DB and cache it. In the same time Acumatica will auto-reset when the linked table is changed. This is… Read more

In-Screen Popup Panels with iFrame

Hi Everyone, Most probably you have seen the function in Acumatica where you can open a new screen in a iframe on top of the existing screen without navigation. This approach has some benifits and disadvantages. Have inplace pupup helps to have less redirection and less windows, but in the same time it blocks the previous page and you cant modify/see background untill you close the popup. Choose the way you use wisely based on the requiranments and design you have. How to call inline popup? public PXAction<SOOrder> createPrepayment; [PXUIField(DisplayName = “Create Prepayment”, MapViewRights = PXCacheRights.Select, MapEnableRights = PXCacheRights.Update)] [PXButton(ImageKey = PX.Web.UI.Sprite.Main.AddNew)] protected virtual void CreatePrepayment() { ARPaymentEntry target =… Read more

Selecting data though Acumatica PXSelectorAttribute

Hi everyone, Today, I would like to share with you small tip to work with PXSelectorAttribute base on my experiences. Here is the story, let me image that you have the DAC and you want to add more information which is just supporting information and you dont want to save it. Please take a look on my DAC bellow. And now I would like to get the value of Default Price to display after I choose the Inventory Item. I will create code in the in the FieldUpdatedEvent like bellow In the conclusion, depends on your scenario you can use PXSelectorAttribute to get data from the cache. It would be… Read more

Select Multiple Documents into One Grid

Hi Everyone, In some situations you may want to show different unconnected documents inside one grid. Just for example you want to create Customer Overview screen and show all Invoices, Payments and Sales Orders together in one place. Join tables together is not the best approach, as you will have to add different columns with same names for fields from different tables. Better Approach is select them independently in Data View delegate and merge them into one virtual DAC. So plan is the following: Create a new Virtual DAC that will represent any document in the system. Please note that this DAC should have a Key that should unique even… Read more

Context Parameters

Hi Everyone, In this topic I want to cover another architecture pattern we have in Acumatica – Usage of context related parameters. Problem Statement Within the event model it is not easy to pass parameters into the other child or related events. There is a way with local variables how it is shown in T300 Training Guide and Override Release Action Lesson. However it is a really not nice approach if events happens in different objects like here: public class SomeGraph : PXGraph<SomeGraph> { public void CreateBatch() { bool needValidate = true; //Create Batch } } public class JournalEntry : PXGraph<JournalEntry> { public void DAC_RowUpdated(PXCache cache, PXRowUpdatedEventArgs) { if (needValidate) { … } } } Solution In Acumatica we use an approach that we call Scopes. Scope is a class that set… Read more

Generic Events Declaration

Hi Everyone, Starting from Acumatica 2017 R2 you may notice a different events declaration. We call in generic events or new events declaration. Here you can see an example for row and : protected virtual void _(Events.FieldUpdated<DAC, DAC.field> e) {} protected virtual void _(Events.FieldDefaulting<DAC, DAC.field> e) {} protected virtual void _(Events.RowUpdated e) {} protected virtual void _(Events.RowSelected e) {} protected void _(Events.CacheAttached e) {} From the functional side there is not difference between old and new events declarations. However with generic events you have 2 main benifits: No more mistakes in names of DACs or Fields. As you rerefence it by tipe whong name won’t be even compiled. Don’t need to cast DACs anymore from e.Row anymore. It will have a typeinside. PXCache cache = e.Cache; DAC row = e.Row; However there are a couple of… Read more

Acumatica 6-tiers Web Architecture

Hi All, Recently got a question about Acumatica web architecture and tires. To answer it I have prepared slide that I would like to share with you now: Acumatica 6-tiers Web Architecture: Acumatica Cloud xRP Platform (Presentation, Business and Data Access tiers): The basic diagram of Acumatica SaaS hosting Have a nice development!

Resort grid rows with Drag and Drop

Hi Everyone, In Acumatica 2018R1 we have a new cool feature to drag and drops rows of the grid to resort them. As you can see sorting is still based on database column (In my case it is Sort Order) but Acumatica can automatically reorder all rows based position you dropped it. This is just a first version so still have some limitations (like it is still not fully works with extensions for existing DACs), but I really like we can  bring new and very friendly user experience to ERP. How to implement it in own code? To have this feature you need to change several things in your Graph,… Read more

PXSelector and DirtyRead

Hi Everyone, Want to speak today about Dirty Read property of selector. Base explanation you can find in Acumatica API reference. How ever this one is very basic, so let me try to share with you real case. You may know about Readonly vs Merged data retrial from DataView. Basically if you use PXSelectReadonly data-view it will always return data only stored in database. If you use standard data-view like PXSelect Acumatica will get data from DB and than merge it with unsaved data from cache. This is fully applicable for data-views (PXSelect, PXSelectReadonly) and selectors as well. When you define PXSelectorAttribute than it will be always read-only by default.… Read more

Multi – Line Text Edit control

Hi Everyone, In case you need to store rather big text you may need to use multi-line text edits. Here I would like to share with you example based on Address Line on Customer Form. Multi line just a property of the text edit so if you just change mode of control in Customization browser you will be able to use enter in control already. As soon as you publish customization control will add cut angle what you can use to control its size with mouse: If you also set height property of control for example to “100px” size will be extended in UI by default: Important to note that… Read more

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