Monday, 30 November 2015

Custom Snapshots Configuration

Hi Everyone,

As you know Acumatica supports Snapshot functionality to copy, migrate, backup and restore data between one or multiple instance of Acumatica. Using snapshots you even can migrate data between different database types (Cloud, Microsoft Sql Serve, MySql).
You can get more about snapshots from this video - Acumatica Snapshot on YouTube

When you creating snapshot, system will go through all database tables, select appropriate data and put it into separate tenant (with negative tenant id, which is actually linked to original tenant by id number).
You can define what data will selected from the database, by defining Export mode:
Acumatica Snapshots Configurations
Snapshots is database level technology that knows nothing about business logic and other stuff. System will just go through all specified tables and copy all data with no restrictions and no validation.
But you can define your own configuration for snapshots engine.

Saturday, 28 November 2015

How to Generate a new DAC for Custom Table or View

Hi Everyone,

In Acumatica 5.2 we have a very nice feature where you can generate a Data Access class from the table definition just from Customization Browser UI.

To do this, go to the Customization Manager, open code section and create a new code file of type IBqlTable. If you specify a name of existing table, system will automatically load a definition for all fields from database.
IBqlTable is required interface for all data access classes in Acumatica. System will use it as a flag to understand what name should be used for table during SQL generation.
Acumatica Browser DAC Generator

When you click OK, system will analyze table structure and generate new DAC with all fields and appropriate attributes. All these stuff is done according to Acumatica naming convention.
Acumatica Auto-Generated DAC in Browser

And of course, you can always move this code file to extension library, if you need to use it with Visual Studio.

Have a nice customization!

Friday, 27 November 2015

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.
    Acumatica Sitemap
  • But if you want to do more interactive dialog with user you may need use popup dialog with smart panel. In This case you can show some configuration to user that is related to requested operation. This panel will be hidden on the screen until you call it with appropriate code from your business logic. When user close panel, your code will be automatically notified about configuration changes.
    Acumatica smart popup panel

Thursday, 26 November 2015

First Chance Exception Log in Acumatica

Hi Everyone,

Acumatica has very powerful feature to catch and logging all exceptions that that has been thrown inside the system and application code. You are able to activate it in the Application Settings section of web.config file.

<add key="EnableFirstChanceExceptionsLogging" value="false" />
<add key="FirstChanceExceptionsLogFileName" value="firstchanceexceptions.log" />

If you do not change the file name, it will be available by this path: “<SiteFolder>\App_Data\firstchanceexceptions.log”

This log can help a lot if you get any error without stack trace, or when you getting any problem without any information in the UI. Also this log can be very useful for Acumatica support team.

You need to understand that using this mechanism you will catch all exception even good and handled ones. Because of this system will fill this log file quite fast, so i recommend you to enable it only for short periods of time, where you are investigation the issue.

Starting from Acumatica 5.2 you also can enable if from user interface.
Catch Expetions in Acumatica Request Profiler

Have a nice troubleshooting. 

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 you initialize scope it will tweak framework, to allow you do some forbidden stuff by default. When you dispose scope, it will revert all settings to the previous state.
Scope changes are applicable only for the current thread and will not affect other users/threads.
Also scope, if you use scope like here:

using (new SomeScope())
//Do some logic here

It will affects only the underlined code. System automatically revert changes when code leaves this block.

Now, lets discuss what types of scopes you can use in Acumatica:

Thursday, 12 November 2015

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 data you can calculate and combine data with programming code as you wish. This way can be slower on big amount of data, but also here you have more control.
Here I want to describe in details the second way to do it.

Wednesday, 4 November 2015

Custom Pictures to Login Page

Hi Everyone,

Do you want to customize login screen to see custom images that are related to your own company?
Acumatica Login Page

No problem, just put it into the Images folder (C:\Program Files (x86)\Acumatica ERP\<Your Site Name>\Icons) with the specific name pattern (login_bg<Number>.jpg).
Acumatica Pictures for Login Page

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.
Acumatica Custom Fields

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.