Wednesday, 27 July 2016

Publish customization through Web Services API

HI All,

Today I want to share with you one new cool feature in latest 5.3 update of Acumatica.

You may know that Acumatica has a special type of Web Services API -  Service Endpoint. This API is designed to work with Reports and Report Designer. In genera Report designer is a standalone win form application that communicates with acumatica using web services API. Also this API contains some really old ways of integration that are here just for compatibility purposes.
URL for this services API is: https://<instance>/api/servicegate.asmx
5.3 update of Acumatica
But starting from version 5.30.2126 it also can work with customization packages.
Newly available methods:
  • UploadPackage - helps you yo upload zip package to acumatica through API
  • PublishPackages - helps you to publish selected packages
  • UnpublishAllPackages - helps you to unpublished all customization.
Hope this will help you to better maintain customization.

Have a nice deployment!

Thursday, 21 July 2016

Sub-Menus for Action

Hi All,

Today I want to share with you one cool way to organize your actions.
organize actions in acumatica
Actually this is quite simple, you just need to add sub-actions as a menus text to the main action.
MainAction.MenuAutoOpen = true;

Code Snippet:

If you want to have an action with sub-items on grid (like in my example) do not forget to hide actions on data source:
<px:PXDSCallbackCommand Name="MainAction" DependOnGrid="grid" Visible="False" />

Have a nice development!

Monday, 18 July 2016

Two way to rebuild all indexes in Database

Hi All,

Today I want to share with you 2 scripts that you can use for rebuilding all indexes in your Acumatica database.


Second what by using DBCC DBREINDEX command:

Have a nice maintenance!

Thursday, 14 July 2016

New way to work with CustomInfo of PXLongOperation.

Hi All,

Today I want to share with you one change in Acumatica framework that may affects your development and customization. I will speak about PXLongOperation and Set/Get Custom Info methods.
Acumatica framework
Idea of PXLongOperation is quite nice - it helps developers to automatically manage background processes as as the result save a lot of time. PXLongOperation class is designed to lunch, terminate and get the result of all processings, that takes a lot of time for some calculations. Acumatica Framework automatically creates thread, ensure its stability, catch errors (if any) and than notify end users about the result of the operation.

As UI leaves separately from all server processing, you do not have any way to do direct communication from processing thread to business logic. So UI in the browser periodically generates a callbacks to server to check statuses of processing operation. If operation has been finished, you well see the result of the operation. There is also some additional logic what to do if operation has been failed or completed successfully:
  • Do we need to attach an error to some field?
  • Do we need to reread data from database? Here system will automatically call Cancel action on the graph, when operation is completed.

Some times you need to have more communications between background thread and main application code, like custom error notifications or sharing of the processing result. Especially for this task Acumatica framework has set of methods:
  • void SetCustomInfo(object info);
  • object GetCustomInfo(object key);
  • bool HasCustomInfo(object key);
  • void SetCustomInfoPersistent(object info); 
  • object GetCustomInfoPersistent(object key);
  • void RemoveCustomInfoPersistent(object key);

Monday, 11 July 2016

Database Maintenance

Hi Everyone,

Today i want to share with you some ideas of how you should take care of you database. Database is really highly loaded system: you doing a billions of operations,creating of millions of records every day/week/month. And all of these things should go together with highest security, performance and redundancy.
To ensure a health of your database you should take case of it regularly, the same like you do with your own health. Otherwise, some day you will see something like this:

This really means that something wrong happened with your database. It might be hardware, software, network or other failure.

To ensure you database health, just schedule a regular maintenance plan and let system exceute it every week.

To Schedule the Weekly Maintenance Plan by using the Maintenance Wizard in SQL Server Management Studio, schedule the following tasks:

  • Database Integrity Check: Checks the logical and physical integrity of the database. Here you can run various of operations such as:
  • Rebuild Index: Helps remove gaps in data pages and eases the data retrieval process 
  • Shrink Database: Removes space by moving pages from the end of the file to the front, and then deallocates the excess space back to the file system
  • Update Statistics: Internally updates statistical information about tables and indexes used by SQL Query Optimizer during data retrieval requests
  • Recompile stored procedures
You can find more information on creating maintenance plans and other advises in this and this articles from Microsoft. 
An example of the recommended maintenance plans you can see in the following screenshot

Also I highly recommend you to establish some monitoring procedure. This may significantly simplify control, as you will be automatically notified by monitoring system about some performance or other degradation.
For example in Acumatica we are using PRTG Nework Monitor tool to keep eaу on database server and all databases. This tool will automatically send notification to all admins, if there will be any abnormal speed or reply.
In general this tool can save a lot of your time and make you customer happier.

Have a nice deployment!

Thursday, 7 July 2016

Approving of Requisition Requests depend on budget validation

Hi All,

Starting from past release of 5.3 (version 5.30.1966) Acumatica has added new option to help you to define different approval logic depend on the budget validation.

On the RQRequest DAC now we have a new field "Is Over Budget", that you can check when you configure your approval maps.
RQRequest DAC

This flag will be automatically calculated by the system, when any line in the request has exceeded the configured budget. Actually this flag represents the budget validation warning.

The budget validation and system behavior on budget exceeding can be configured on Request classes form. System can raise errors, warnings or do nothing. If we want to approve over-budget items manually this should be a warning, as in the error case Acumatica will not allow to release request even if it is approved.
request classes acumatica

Have a nice configuration!

Monday, 4 July 2016

Multi-Level Approval in Acumatica

Hi Everyone,

Today I want to sore with you and idea of how to define the multi-level approval workflow in Acumatica ERP.
Acumatica has approval feature in many different parts of the system, like Sales/Purchase Orders, Requisition, Requests, Projects and now starting from 6.0 also on AP documents.
multi-level approval workflow in Acumatica ERP.
Every time when you need to define approval hierarchy, you should check the "Assignment and approval maps" screen in the system.
The main idea on defining multiple levels of approval is that you need need to create dependent conditions, when each next level can check that the previous level is approved. So:
  • On the first level you just need to specify "base" conditions 
  • On the next levels you need to set conditions which will reflect and pull condition from the previous level,
  • Need to change order of the levels and set to the top rule with higher level (for example max amount).
Lets do one example based on Purchase orders approval, where we want to to define up to 3 levels of approval depend on order amount.

Friday, 1 July 2016

Hidden file revisions clearing action in Acumatica

Hi All,

Today I want to show you one one trick that can help you to purge revisions history of all files in Acumatica and keep database lighter.
Acumatica has a hidden button, that can go through all files in the system and check revisions. If date of revision is older that specified one, Acumatica will delete all revisions except the latest one.

By default this function is hidden for security reasons, so if you want to enable it be really careful and restrict assess rights from all uses except system administrator.

Ok, to enable this hidden function, you should use Acumatica customization tools for screen "Search In Files" (SM202520).
Our main goal is to change visibility of hidden button:
change visibility of hidden button in acumatica
To change the PXUIFieldAttribute property we shall do:

  • Create an customization project
  • Add graph extension for graph "PX.SM.UploadFileInq"
  • Add new action with the same name as base one - in this case Acumatica platform will call ours action instead of base one.
  • Add button handler to call base logic.
  • Publish customization.
Code snippet:
  public class UploadFileInq_Extension:PXGraphExtension<UploadFileInq>
    public PXAction<FilesFilterClearFiles;
    #region Event Handlers
    [PXButton(Tooltip ActionsMessages.ttipClearFiles)]
    [PXUIField(DisplayName ActionsMessages.ClearFilesVisible true)]
    internal IEnumerable clearFiles(PXAdapter adapter)
      return adapter.Get();

After customization publishing process you will find new button on the search in files screen.
change visibility of hidden button in acumatica

By clicking on this action you will be able to provide date, by what all revisions should be cleared.
Depend on the database size, process may take significant amount of time

Have a nice clearing!