Running Automaton Button from code

Hi All, Here I want to share one example of customization. We want to trigger a button that is defined as Automation action from code. The problem here is that the button is not defined in the code, so we need to trigger it the same way how UI does it. To do this we have do several tricks: Define a new custom PXView that will return record that we want to process Create an adapter, that will provide data for button handler. Adapter will get data from custom PXview. Create a separate instance of graph, that will handle action. Code example with comments: View the code on Gist. Big… Read more

Read Excel File In Acumatica

Hi All, Today want to share with you the easiest way to read Excel or CSV file in Acumatica. Acumatica core (PX.Data.dll) contains 2 classes that may help you with reading some files: PX.Data.XLSXReader – can read Excel file row by row, PX.Data.CSVReader – can read any CSV file row by row. In my example today we will read transactions from excel file and import it to some table. Code snippet: View the code on Gist. Just notice here several important things Do not forget to close reader by calling Dispose method Excel or CSV files may contains first row with headers – you need to skip it manually. You… Read more

Process File In Memory

Hi All, Sometimes you want to upload file to Acumatica but you do not want to save it to the database. This may requires for in-place data processing or uploading data from specific format. Today I want to show you one way, how you can allow user to upload file in the browser and handle it with your server logic. In high level, to achieve it you need to do 3 steps Add special PXUploadDialog panel to your page. This control will handle file upload and save somewhere. By specifying configuration properties, you can control where Acumatica will save a file. In our case we want to store it in session.… Read more

Multiselect Combo Box

Hi All, Today I want to discuss with you one short topic – how to implement Combo box with multiple options for select. As an example I want to use scenario when we need to have a department associated with each particular customer. We have fixed and predefined number of departments so we do not want to configure them. Plus each customer can be associated with multiple departments, so we need to have a multiple options simultaneously. Based on provided requirements, we can find that Combo Box (Drop Down control) is the best option here. To do this I will use Acumatica customization engine. Lets go there and do it… Read more

Update of Dependant Fields

Hi Everyone, Today I want to share with you one scenario when you have dependent field – one field is depend on the value of another field and should be recalculated on change of primary field. But you also have user interface where user can change dependent field as well. So you may have situation when user has changed dependent field and business logic has to recalculate the same field also. By default system will keep user changes as a more important comparing to default changes. But in this article you will learn, how to override this process and make business logic changes more important than users. Here you can find an image that illustrated scenario above.… Read more

Add a Custom Popup Panel

Hi Everyone, Today I want to share with you some practices how you can do iteration with user from Acumatica business logic code. In general: You can ask some simple question with strait forward answer, like: “Do you really want to delete this record? Yes/No” You can use redirection feature to redirect user to some hidden screen, where he will do some additional configuration and processing.You can hide screen by putting it into the hiden folder of Acumatica sitemap. When screen is hidden user can access it only with redirection from some other screen. But if you want to do more interactive dialog with user you may need use popup dialog with smart… Read more

Context Scopes in Acumatica

Hi Everyone, During developing on Acumatica, you may face some restriction, from the platform side, for example: You can select data only according to current user rights – if user does not have access to branch, there is no way to get data related to another branch. There is restriction to read data just from current tenant, now way to get consolidated data by several tenants. You are not able to read deleted data. You can read data just within one connection to database. All these stuff and some more is configuration of the platform. To give you ability to control these behavior Acumatica has a set of internal classes “Scopes”. When… Read more

Union Selects in BQL

Hi Everyone, Sometimes you want to select and combine data from different tables in database. There is no standard way to do it in BQL, but we can go with several workarounds: Create a SQL server view. In this case you just create a view on SQL Server side with selecting, calculating and combining all data into one big select. After this you can create/generate a DAC that will be associated to the view. In the code you can easily use new data access class as you wish. System will always generate selects to SQL server view as it is normal table. Use data view delegate, where you can execute several selects to database. When you have received… Read more

Add Custom Field to Full-Text (Universal) Search

Hi Everyone, Sometime you need to do some customization to meet customer requirements. One of these requirements can be an additional field where they can store some references to other systems/documents. But when you have a reference you have to search it in the system. Here I will guide you, how to customize Acumatica to be able to search additional fields. The main thing that we have to customize here is PXSearchableAttribute, which always have to be defined on NoteID field (you know that NoteID is main and unique reference to any row in the Acumatica database). IF you can check the code of this attribute you can see: The main things here are first 4… Read more

Company Mask for Data Sharing Between Tenats in Acumatica

Hi All, CompanyMask – is a special column that stores binary mask that defines where this record should be visible and where you can update this record. Acumatica stores data in database separated by different tenants. All tenants are isolated, but you have some options how you can share data between them. To do it, your database and table should meet some conditions: Your table should have CompanyID and CompanyMask columns. Without CompanyMask data will be completely separated with no way to read it from other tenant from code. CompanyMask should be configured to allow other tenants select and update this record. Mask contains two flags for all companies. First… Read more

System Columns in Acumatica Database

Hi All, Acumatica has some special database columns, like CompanyID, Branch, NoteID  and so on. Here I will describe what types of special columns you may expect in Acumatica database and when do you need to use them. All these field are optional and does not required to be in all tables. In this article you will find Description of: CompanyID CompanyMask DeletedDatabaseRecord BranchID Tstamp NoteID GroupMask And other Audit Fields: Created/LastModifiedByID Created/LastModifiedDatetime Created/LastModifiedByScreenID Welcome in the article if you need more details. CompanyID  CompanyID – this is main tenant id field. Acumatica is multi-tenant application and this is done by splitting all data using Company ID column. Each row has own… Read more

Acumatica Platform Architecture

Hi Everybody Today I want to share some information about Acumatica Architecture from web interface to database. We will go through: Frameset structure Page structure Main communication protocol between browser and server Business logic architecture Acumatica ORM architecture. Frameset Structure Acumatica is based on ASP.NET technology, so the main thing under main page is Frameset Frameset consists of different menus and the page. Green part is customizable using sitemap, localization, access rights and some settings. Orange part is customizable using Customization Manager, access rights, localization, and many different settings.. Also you can develop new pages using Acumatica Framework. Welcome tho this article, if you want to see more! Page Structure This part is your main… Read more

Cache Data in Memory using Database Slots

Sometimes you need to use some dynamic data from the database, but you need it so often, so retrieving data process becomes a big performance issue. What you need to do? Cache the data? But your date is dynamic and can be modified by the user. So you need to implement some mechanism to reset your cache? Another bicycle… Acumatica Framework can address this issue with Database Slots Technology: Framework stores your data in the HttpContext in special dictionaries. Framework automatically calls Prefetch method on first access to cached data. Framework automatically monitors dependant tables and will reset cache when someone has updated it. Framework automatically handles cluster mode. Access… Read more