Monday, 19 February 2018

Custom Image on Acumatica Form

Hi All,

Want to share with you way how can you add custom Image on Acumatica form.
Acumatica custom Image
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"  />
Acumatica PXImage

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!

Tuesday, 13 February 2018

Cases Escalation

Hi All,

Have you faced the need of escalation process in Acumatica CRM?
In general it is not so complicated to do with work-groups - when you need escalation you just change work-group. Support engineers can monitor a queue (or get a notifications) and work on case.
But here we have quite some manual processes: add escalation note, change status, change work-group.

However we can easily solve it with customization. Let me show you the scenario where you have 2 (or more) buttons: Escalate to L2, Escalate to L3 and so on.
Acumatica Case Escalation Buttons
Each button will show you pop-up form that you need to feel before escalation and do other automation. Pop-up can be pre-filled with text template from Notification Templates. Technically Escalation pop-up is a separate page that is shown as a dialog from code.
Acumatica Case Escalation Buttons
Upon save, our customization will add note to case activities and change a work-group.
Acumatica Case Escalation Automation
Work-group assigned and Template for escalations can be configured on Customer Management preferences.
Acumatica Case Escalation Setup


Project Sources: https://github.com/smarenich/Escalations
Pre-Compiled Project: Escalations.zip

You can easily take project shared and add there own logic and more escalation rules.

Have a nice development!

Wednesday, 31 January 2018

Add new Value to Combo-Box via Automation Steps

Hi All,

Lets assume that you need to add a new value to combo-box control without any dependent logic. And you do not want to do this with Customization as you do not know that. And with Acumatica it is really easy to do.

Lets check an example where you need to add new source for leads. "Source" is just for informational purpose and does not have depended logic (in other words there is no different business logic depend on selected value). So that means that if we add a new value there we do not break anything.
If your combo-box has logic associated (fields enabled disabled / different calculations) than you may need to consider code customization instead of approach described here.
Acumatica Leads

Ok, so if the above conditions is met, we can proceed with adding values thought Automation Steps. "Automation Steps" is automation configuration in Acumatica that allows you to dynamically disable enable controls, add buttons, combo-box values depend on "step" where your document is currently in. For example if document is open you can print report, but if it is closed you cannot.

Here with Automation Steps we can add non-programmatic customization for some fields. Lets add source field for step Open. For our task step is not important as you can add value on any step, but for other tasks you may need to add fields/buttons on every step where you want to use it.
Acumatica Automation Steps

 Than you can use "Combo-Box Values" button to see and add there your own values.
Acumatica Automation Steps with ComboBox

As soon as you save the step you can refresh Leads screen and find a new value there.
Acumatica Leads with Custom Source

Hope it helps and have an easy configuration!

Tuesday, 16 January 2018

Show/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.

Friday, 12 January 2018

Multi-Select Selector

Hi There,

Want to share with you hidden way to add a multi-select Selector control to have better filters.
Acumatica Multi Selector

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
Acumatica Multi Selector Value

To add such control you need to do following:
  1. 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.
    1. [PXSelector(typeof(Ledger.ledgerCD), ValidateValue = false)]
  2. Second step will be UI control definition. Note that there is no such control in the list of available controls, so you have to edit ASPX directly, but it is easy to replace PXSelector with PXMultiSelector. Do not forget Commit changes if you need to filter by this field. 
    1. <px:PXMultiSelector runat="server" DataField="Ledger" ID="CstPXSelector4" CommitChanges="True" ></px:PXMultiSelector>
Multi-Value selector will be good with new In<> Bql operator in Acumatica 2017 R2


Have a nice development!


Monday, 8 January 2018

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 from Acumatica Platform Achitecture UI sends just 4 commends to the server logic (Insert, Update, Delete, Select). So in our code we need to use corresponding data views and call appropriate commands with data provided.
    • header = graph.CurrentDocument.Insert(header);
  • Acumatica uses Events triggered from UI we need to emulate it with calling appropriate commands of Data Views when necessary. For example if you choose Inventory Item, Acumatica defaults some values. We need to emulate this call to server logic with Update command.
    • tran.InventoryID = 691; tran = graph.transactions.Update(tran);
  • We also need follow the flow how user creates a record. For example we need to fill document first before entering transactions.
So basically that is it.

Please check my simple example extension where I create a Inventory Receipt from button on Sales Orders screen.
Acumatica Create Receipt


Code:

Have nice development!

Friday, 5 January 2018

How to Translate Acumatica

Hi Everyone,

It is actually very easy to localize Acumatica to any other language. And here I want to go thought the localization process Step by Step.

System Locales
First thing we need to do is to setup a new Locale on System Locale Screen. Here you can specify name, type and some other preferences. Please note that locale should be active, you can login only to Active locales.
Acumatica System Locales
After you save, you will be able to see new locale on login page even if there is still no translation yet.
Acumatica Locale Selector
Please note that locales are different per each company, so to choose your locale you should select correct company first.

Please note that on the same screen you also can define your preferences for Numbers and Date Time representation with "Show Locale preferences". Also you can define in what languages should some Customers/Items and other descriptions be shown with "Setup Languages" button - this feature is called "Milti-Linguial Fields",

Collecting of String for Translation
Now we need to get strings for translation. But before that we need to collect them with Collect String Button. We need to collect strings every-time before translation as during version upgrades Acumatica may introduce some new labels, also during customization or report building you can add some new labels or error messages also. So the final set of string should be collected from exact instance right before translation.
Acumatica Collect Strings
When process has been you can extract Strings for translation from Acumatica.
There are 2 types of strings:
  • Bound Resources - Labels, UI Elements, Reports and some other things
  • Unbound Resources - Error Messages, TextBox Values, Time Zones, Mobile Sitemap and many others that are not related to particular screen in Acumatica.

Unfortunately Acumatica shows only bound or unbound in the same time, so you have to download files twice with "Show Only Unbound" checkbox defined and without it.

On the time when I made this article (in Acumatica 2017 R2) there were about 30000 strings with different length in each.

Do Translation
You can easily do translation of Acumatica labels in Excel or any other useful tool for you.
After translation has been completed you need to upload it back to Acumatica.
Acumatica Translation in Excel


Upload of Translation
In my experiments it is enough to upload data only for bound resource but I suggest you to upload translated file twice also for bound and unbound resources.

Done. Now you can re-login to Acumatica using new Locale and  you will see fully translated user interface.
Acumatica Thai Translation


Have a fast translation!


Tuesday, 2 January 2018

Attach Files with Rest API

Hi All,

In Addition to my topic with Acumatica REST API where I showed how to retrieve and save records using Acumatica Contract Base Rest API I want to share with you now how can you attach files with the same way.

To Attach file you just need to put binary data by following URL: https://<server>/entity/<endpoint>/<version>/<entity>/<key1>/<key2>/files/<filename>

For example, to attach file to stock item you will have following URL:
http://acusea.acumatica.com/entity/Default/6.00.001/StockItem/AACOMPUT01/files/image.png

Acumatica Files Rest API

File will be attached to entity automatically.

Have a nice integration!

Saturday, 30 December 2017

Access Rights Database Reference

Hi All,

Want to share with you reference about architecture of Access rights in Acumatica.
This knowledge you can use for
  • Sharing data between companies
  • Copy data between companies for faster implementations
  • Mass update of access rights with database
  • Just for fun :)
All acumatica access rights are located in the 6 different tables: Users, Roles, UsersInRoles, RolesInGraph, RolesInCache, RolesInMember. Lets check all of them.

Friday, 29 December 2017

Change Azure VMSize for Acumatica Package

Hi All,

Past several years Microsoft has added multiple possible VM sizes (that you can check here) and they actually will not stop at this point.
azure

So we need a good way to easily change some properties, if we want to have custom Azure configurations. Today i want to share with you the way how can you repack Acumatica Azure package.

To complete there steps you need to have installed:
  • Microsoft .Net 4.0+ for running PowerShell script.
  • Azure SDK 2.9+ You can download it here. Actually you just need a one single tool that will do packing - MicrosoftAzureAuthoringTools-x64.msi. Than you will be able to find a CSPack.exe tool by this path "C:\Program Files\Microsoft SDKs\Azure\.NET SDK\v2.9\bin" CSPack can generate *.cspkg files, that are actually should be uploaded to Azure
  • 7zip.exe for extracting files
The idea about this approach, that Azure package is just a Zip file, that can be extracted. So we can extract it, change required configuration and pack it back.

Here you can see folders structure that I have prepared for this task:
folders structure acumatica
  • In the "In" folder you should put your Acumatica Service.cspkg right there.
  • "Out" folder will contains repacked file in the end of process.
  • "Package" folder contains some tools and temporary extracted files required for the process.
     folder contains acumatica
    • "7za.exe" - 7zip console tool
    • "template.txt" list of system files required for packing
    • "properties.txt" list of additional required properties
  • "1-extract.bat" will extract data from standard package.
  • "2-pack.bat" will pack data back after modification of properties.
  • "ServiceDefinition.csdef" is Azure csdef file that contains some properties and actually includes vmsize that we need to change. 
vmsize

So the entire scenario:
  1. Download Acumatica Azure Package from Acumatica web site.
  2. Put Package to "In" folder
  3. Run Extract.bat
  4. Change vmsize in the "ServiceDefinition.csdef" file to required size for your company
  5. Run Pack.bak 
  6. Get Result package from "Out" folder.

Code files:

Have a nice Installation.

Wednesday, 27 December 2017

Link Between GL And AP/AR

Hi There,

In case you have not seen that before, Acumatica has links between GL Batch lines and AP/AR Invoices lines - Following conditions should be applied:

  • GLTrain,TranType = ARTran.TranType;
  • GLTrain,RefNbr = ARTran.RefNbr;
  • GLTrain,LineNbr= ARTran.TranLineNbr;
TranLineNbr is populated on release of a document in another module with the number of the corresponding line in that document.

Please note that TranLineNbr can be empty in some cases. For example if you have consolidation posting to GL, than multiple AP/AR trans will be combined in one GL line, in that case TranLineNbr cannot be evaluated. Specially this field is not populated when PX.Objects.GL.GLTran.SummPost is ON.

Using that knowledge you can update something in GL from AP/AR transactions. For Example:

protected void GLTran_TranLineNbr_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
{
       GLTran row = (GLTran)e.Row;

       if (row != null
&& row.RefNbr != null && row.TranType != null && row.TranLineNbr != null)
       {
              ARTran tran = PXSelect<ARTran,
                      Where<ARTran.tranType, Equal<Required<ARTran.tranType>>,
                             And<ARTran.refNbr, Equal<Required<ARTran.refNbr>>,
                             And<ARTran.lineNbr, Equal<Required<ARTran.lineNbr>>>>>>.
Select(Base, row.TranType, row.RefNbr, row.TranLineNbr);
              if (tran != null && tran.Date != null)
              {
                      row.TranDate = tran.Date;
              }
       }
}

Have a nice Customization.

Calling Base Actions by example of Generating Time Cards

Hi All,

Just a short article where I can share with you customization that can generate time cards from uploaded time activities.
 time cards
Customization doing following:
  • Selects the first and the last unreported (where no time-cards assigned) activity from currently selected employee.
  • Goes week by week between first and last activities
  • Create a new time card for every week using TimeCardMaint graph
  • Code also automatically submit time card for approval
  • In case there is unreported activity for already submitted or released time card, code can automatically generate time card correction and submit it again.

Tuesday, 26 December 2017

Dashboards and Reports on Mobile

Hi All,

Do you know that Acumatica Mobile native app has supported dashboards and reports since release of version 2017 R2.
dashboards and reports acumatica
Here you can see YouTube video with full presentation of Acumatica Mobile capabilities - Acumatica Mobile App - Functionality and Customization

But in this article I want to show you how to configure it by you own. Welcome under the cut.

Monday, 25 December 2017

Restore Large Snapshot

Hi Everyone,

Have you seen such error before when you try to upload snapshot of the size more than a gigabyte?
The Error message: "Snapshot file size exceed the maximum allowed size".
Acumatica Snapshot Size Limits
There are multiple reasons why it is not allowed - connection stability, IIS limitations, Memory size, on the fly processing limitations and so on.

But what you still need to restore a snapshot and you need to in any possible way? Lucky you there is a stable way for that using Acumatica Configuration Wizard.

Monday, 18 December 2017

Visual Studio Code Snippets

Hi All,

If you search on ways to optimize your development experience you can try to look at the code snippets for Acumatica events and DAC fields.

Here it comprehensive instruction on how to develop own code snippets.
I want to share with you snippets I use in my own local environment. Please follow the installation Instructions:

  • Below you will see the XML code from GitHub Gist that you need save as a file: Acumatica.snippet
  • Place this file to snippets location : C:\Users\<username>\Documents\Visual Studio 2015\Code Snippets\Visual C#\My Code Snippets
    • Code Snippets
  • Launch your Visual Studio and try to use it.

    • Code Snippets

Code snippet is under the cut.