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. 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. It is not very useful customization, but it can be used as good example of calling actions in… Read more

Multi-Company Drop-Down

Hi All, Today want to show you how to have different values of drop-down in different companies: Company One Values 1, 2, 3 Labels “1”, “2”, “3” Company Two Values 3, 4, 5 Labels “1”, “2”, “3” To do this we can use following nice features in Acumatica Platform: PX.Data.Update.PXInstanceHelper.CurrentCompany – to get ID of current company FieldSelecting – Event where you can change/adjust value just before it will be included in response to browser. e.ReturnState = PXStringState.CreateInstance(…) – State contains full description of control that should be generated in the user interface with app UI properties and configurations. By adjusting state on the fly you can change list of… Read more

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. 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. 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”… Read more

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. 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. < In the code realization… Read more

Recurring Notifications about Expiring Quotes

Hi There, Any ERP system is designed to help users as much as it is possible. And one of very common human bug is bad memory. So ERP should solve this issues by recurring notification on multiple possible documents/items. Just as for example, how cool is to have notification on expiring contract, quote or cases, so we can take an action in advance. Based on the previous article on notification from templates that I have shared with you few days before, we can design an processing screen that will send notifications for us. So the main idea around it is – every day Acumatica scheduler will trigger our logic, that… Read more

Filtering Inventory Items by new Field

Hi There, Have you seen a situation when you want to filter list in the selector by the custom field? Most probably yes, as that is quite common requirement form many different users. Here I want to show you how to do that easily based on example with custom field in Inventory Item. Custom Field First of all lets add a custom field to inventory item. nothing complicated, just a custom text box. Showing Field in Selector By default that field will not be shown in selector, but we can easily add it there by modifying PXUIField Attibute: Visibility = PXUIVisibility.SelectorVisible. public class InventoryItemExt : PXCacheExtension<PX.Objects.IN.InventoryItem> {        #region UsrModuleNumber       … Read more

Sending Notification Template from Custom Code

Hi There, Today want to share with you how to send emails from Acumatica custom code based on Notification Templates. User scenario is very simple – lets assume we want to send an email from Acumatica that informs about contract, quote expiration or something else. But in the same time we want to keep activity linked to our document for the future reference. Basically, if we do that manually we need to create new Email activity, fill all details there, attach to entity and send it than, The obvious way to automate it is usage of Notification Templates. Notification templates are special type of emails, that can be combined dynamically… Read more

Get PDF file from Report using Code

Hi Everyone, In this article I want to show you the way how you can dynamically generate PDF file from any report of Acumatica and attach if to an entity. I will do that on example of printing AR Invoice Form out of AR Invoice with custom button In general that task can be split in 4 steps: Defining reports parameters Creation and processing report Get report as PDF file Attach report to entity Parameters All reports have different parameter so before writing a code, check what parameters are required in that report. All parameter should be provided as dictionary – name/value. Report To work with reports you need a… Read more

Launch Multiple Reports with one Exception

Hi All Today I want to share with you an example how you can launch multiple unrelated reports with one single PXReportRequiredException. PXReportRequiredException has a helper method – CombineReport(..), where you can pass multiple ReportRequiredExceptions and Acumatica will process them together. Acumatica will extract each separate report from extension and can open it with following rules: Print all report as a single PDF file – ex.SeparateWindows = false; Open each separate report in a new tab – ex.SeparateWindows = true; There same rule as with other Pop-ups we can open it with new tab, window or the same window as well – ex.Mode = PXBaseRedirectException.WindowMode.New; Also note that you should pass report parameters… Read more

Copy notes from AP/AR Invoice to GL Batch

Hi All, Just want to share with you short example of how you can copy Notes and Files from AP/AR invoices directly to General Ledger Batch. For archive it we are doing following steps: Define extension for (AP/AR)ReleaseProcess graph. Exactly this graph is responsible for releasing operation. On the Initialize method we are trying to subscribe on InstanceCreated event for JournalEntry graph, where we can catch exact graph instance used for saving batch. InstanceCreated even is very useful for customization purposes. Here you can subscribe events and pass parameters between different graphs. Subscribe to ARRegister_BatchNbr_FieldUpdated to catch moment when batch is saved and linked to our invoice. Using graph and batch number… Read more

Hide Action from Datasource

Hi All, When you new create action in the PXGraphExtensions, it is automatically getting visible in in the data-source actions bar, even if you have not customized ASPX. public class JournalEntry_Extension:PXGraphExtension<JournalEntry> {     public PXAction<PX.Objects.GL.Batch> NewAction;       [PXButton(CommitChanges = true)]     [PXUIField(DisplayName = “New Action”)]     protected void newAction()     {     } } It looks like here: But if you want to hide that button, it is very easy to do it with Customization Browser. Just drag and drop button to the data-source in page editor: Than just set the Name to your action name and Visible to false. That is all. Now Action is not visible anymore. Have a nice development!

Customization and Source Control

Hi All, I’m sure you know that Acumatica customization project is just a big XML file that has some links on external files. You can easily export ZIP archive with all linked files and store it on the file system. Unfortunately is not really good for tracking changes. But do you know that Acumatica has very easy-to-use integration with source control where you can export project as set of text files? Let me show you how to use it: As I said customization project is big zip file, but it can be split by items, that you can see using File -Edit Project Items menu: All of these items we… Read more

Override Static Method

Hi All, Unfortunately sometimes during customization you may need to override some logic in static methods and that is really bad task, as it requires to copy a lot of code. Here I will show you few examples that can give you idea how you can fix it. In general there is no way to really override static method, the only one way how you can replace it’s logic is just define a new one and replace all places where it is called. 3 different scenarios will be based on Acumatica Fixed Assets module: Not so good – static method on event AssetMaint.LiveUpdateMaskedSubs(PXGraph graph, PXCache facache, FALocationHistory lochist); Bad –… Read more

Dynamically Activate Extensions

Hi All, Today I want to share with the way how you can enable and disable extensions dynamically. You know that when you have published extension as a DLL or a Code file it will be automatically discovered by Acumatica Framework and used. However there is a hidden way to stop Acumatica from usage of that extension. Do do that you just need add static method IsActive() to your extension. public class GL_Batch_Ext : PXCacheExtension<PX.Objects.GL.Batch>   {           public static bool IsActive()       {         return false;       }   } Acumatica will automatically call that method by signature (you need to have correct name, public, static and return bool) and if it returns… Read more

Approval Workflow Customization

Hi Everyone, Today I want to share with you one important point about customization of automation approval workflow. Firs of all please read this article on Stack Overflow to understand how Acumatica Approval works. But here I would take Purchase Orders screen as example, because there we already have automation workflow configured. In the article below, you may notices that all approval logic is encapsulated into the special Data View – EPApprovalAutomation. On the Purchase Orders form it is designed like this: [PXViewName(Messages.Approval)] public EPApprovalAutomation<POOrder, POOrder.approved, POOrder.rejected, POOrder.hold, POSetupApproval> Approval; EPApprovalAutomation is just a class with multiple virtual methods that you can override and customize. So we can create our own approval… Read more

Append and Replace of DACs Attributes

Hi Everyone. Today want so share with you some ideas on how you can append, replace or merge attributes on standard Acumatica’s data access classes. Acumatica Framework attributes are used to add common business logic to the application components. Attributes implement business logic by subscribing to events. Each attribute class directly or indirectly derives from the PXEventSubscriberAttribute class. B Most attributes are added to data access class (DAC) field declarations. There are also attributes that are placed on a DAC declaration, view declarations in a business logic controller (BLC), and the BLC declaration itself. In general there are 4 places where you can define attributes: DAC attributes DAC fields. You… Read more

Enabling Upload from Excel for the Grid

Hi All, Today I want to share with you a way how to enable upload form excel for custom grid. Actually this is quite simple – Step 1 – define PXImportAttribute on data the data view under the grid. public class CSCalendarMaint : PXGraph<CSCalendarMaint, CSCalendar> { …        [PXImport]        public PXSelect<CSCalendarExceptions> CSCalendarExceptions; … } Step 2 – enable appropriate Grid Mode (Allow Upload) on the grid properties. This will enable upload button on the grid action bar with standard functionality. In some cases, you may want to have more control on the import process. In this case you also may implement optional interface: IPXPrepareItems. This interface should be implemented on… Read more

Using Colors in Acumatica

Hi All, Today I want to share with one way how you can highlight some Acumatica rows or data with colors or other text styles. Disclaimer: Please note that this way does not follows the standard customization way, so any changes may be not supported in future versions of Acumatica. Also it might be very complex to support this customization during Acumatica upgrades. Before we can change colors, first of all we need to do understand how Acumatica applies styles. Acumatica uses Cascade Style Sheets (CSS). All elements (Forms, Grids, Row, Fields, Buttons, …) are associated with one or many styles. All styles are defined in Acumatica folder itself You… Read more

Custom Formula for ACH/GIRO Providers

Hi All, In the previous article about custom payment providers i have mentioned that Schema file supports several build-in formulas, like: Count – Count of details or nested groups in group TotalCount –  Total lines in all nested groups BlockCount – Count of internal blocks including adjustments for fixed structure CountOneBased –  CountField  + 1. Required if you need calculate header or footer with details TotalCountOneBased – TotalCountField +1. Required if you need calculate header or footer with details You also can add more formulas there. For example if you want to have Count that will calculate header and footer together with details you may need TotalCountTwoBased formula. Please check this code… Read more

Client Events using JavaScript

Hi All, Today I want to share with you one way how you can add some client validations/calculation using JavaScript right in the browser with no accessing server data. In general i would suggest you to not do any complex calculations on client side and always use server for all data manipulations. However in some specific situations this approach may save a lot of processing time because client events may do calculations right in the browser. Also note that client logic will be available only for browser users and will not be triggered from web services API and Mobile application. The scenario that i want to do is quite simple… Read more