Monday, 28 August 2017

Disaster Recovery vs Failover

Hi All,

Today want to speak with you about protecting your ERP from accidents.

There are 2 possible way to protect you application from disaster, which are different by approach and recovery time:
  • Disaster Recovery (DR) - involves a set of policies, procedures and tools to enable the recovery infrastructure and systems following a natural or human-induced disaster. So basically disaster recovery assumes that disaster can happen and we just need to recover it as soon as possible.
  • Failover Protection - is automatic switching to a redundant computer server, system, hardware component or network upon the failure. Failover basically assume that stability of the system should not be affected by any disaster. 
Lets check how can we implement it in Acumatica.
In the explanations below i'm keeping away from network disaster, as it is a separate topic not related to Acumatica.

Friday, 18 August 2017

Adding new Report Button on Invoices and Memos screen

Hi All,

Today want to share with you the case how to add a new button to print alternative Invoice Form right from Invoices and Memos screen.
Invoices and Memos screen.
Lets check how does that work and check how original button "Print Invoice/Memo" is configured.

Automation Steps
Fist of all if you check the code, there is no handler for "Print Invoice/Memo". That is some sort of virtual button defined through Acumatica Automation Workflow.
Acumatica Automation Workflow
If you check Automation Steps for "Invoices and Memos" screen you can find that menu "Print Invoice/Memo" is added to action "Report".  That is exactly action that will be executed in the code.

If you click "Fill With Values" button you also can see that this action passing some parameters to code.
Acumatica Automation Workflow
Fields with normal name (like "Printed") are real DAC fields. Acumatica will put there your value when you click on button.
Fields those started with "@" is not a read field, they are parameter of functions in the code.

Monday, 14 August 2017

Number to Words Localization

Good Day.

Today want to give you an idea on how can you customize amount to words transcription in Acumatica.That might be required for any language localization.
customize amount to words transcription in Acumatica
Here you can find simple example, but real complexity might be related to your language rules.

All the main work around that feature is done by [PX.Objects.AP.ToWordsAttribute]
It can be defined on virtual field, and upon accessing by UI or Report will do automatic transcription from number to text.
e.ReturnValue = LangEN.ToWords((decimal)((PXDecimalState)DecimalVal).Value, ((PXDecimalState)DecimalVal).Precision);

If you need you can apply that attribute to other amounts and reuse transcription for other reports.
You can read more about it on StackOverflow.

Wednesday, 9 August 2017

Printing Two Reports at Once

Hi All,

Want to share with you one trick that I just discovered with help of one of our great partners in Africa region.
create 2 reports

If you need to print 3 copies of the invoice (Customer Copy; Finance Copy; and Distribution Copy) at one click, you can use this trick:
All you need is just create 2 reports and include copy into the main one as sub-report.

See steps here:

1) Have 2 reports. I'm using here 2 invoice formats form Sales Demo data.
create 2 reports acumatica

2) Open main (of first) report in report designer and add new sub-report in the last (report footer) section.
report footer acumatica

Do not forget to do following there:
  • Specify Second report name in the sub-report configuration.
  • Pass parameters from main report to sub-report
  • Add a page break before printing a copy
3) Now you can save report to Acumatica and test it.
save report to Acumatica

Have a nice reporting!

Monday, 7 August 2017

Redirecting to External Page from Button

Hi There,

Want to share with you my experience with working with redirects from Acumatica.
redirects from Acumatica

You may know that due to security issues and stability of software, redirect to external web site in the iFrame is forbidden in Acumatica.
So every time when you use "PXRedirectToUrlException" for url like "" system will open url in separate window/tab. That is OK in mane cases, but sometimes you really need that functionality.

One way to solve that issue is well described in a separate article - Redirect on Page Load 
But that one is applicable only if you want to have a menu item in Acumatica SiteMap.

If you want to redirect use based on internal logic/code, that this way may not be the best.
To understand how to solve that issue, I want to explain how redirects works in Acumatica first

You know there there are multiple redirect exceptions available:
  • PXRedirectRequiredException
  • PXRedirectToUrlException
  • PXRedirectWithReportException
  • PXRedirectToGIException
  • And many others.
But basically all of them are different only in how system search for required URL and with cache of items (if you redirect to another screen). So for example "PXRedirectRequiredException" will find URL from sitemap based on graph type to what you do redirect.

After url is determined, system cancel current round trip and returns a special message back to JavaScript in the page. This message is "eRedirect<CODE>:<URL>" keyword with url and no other data.
<CODE> - is a number from 1 to 8 that defines how system should open new page
  • Redirect0 - open page in the same iFrame with no keeping session
  • Redirect1 - same as above but with keeping session
  • Redirect5, Redirect6 - same as above but with new popup
  • Redirect3 - will open new frame-set
  • Redirect7, Redirect8 - will open a new window

So as soon as you know how does it work, there is simple solution - throw your own exception with specific code instead of standard one:

    public PXAction<PX.Objects.PO.POReceiptRedirect;
    [PXButton(CommitChanges true)]
    [PXUIField(DisplayName "Redirect")]
    protected void redirect()
       throw new Exception("Redirect0:" "");

That code will open Acumatica page in the same frameset, just as an inner page.
redirects from Acumatica

Have a nice redirection!

Tuesday, 1 August 2017

Copy Dashboard using SQL

Hi There

In case you need it, in Acumatica 6.0 and later all dashboards are located in just 2 tables - Dashboard and Widget.
We planning to add ability to copy dashboard soon, but until it is not available, you can use that SQL stored procedure.

There is procedure and code to execute it.

SQL Script: 

Have a nice dashboard designing!