Contents tagged with Acumatica

  • How to unit test SOOrderEntry extension in Acumatica

    Hello everybody,

    today I want to show to unit test, and I mean really unit test SOOrderEntry graph extnesion in Acumatica with XUnit.

    In order to achieve it, you'll need following steps:

    Create .Net Class library

    Reference xUnit

    Create public class that inherits from TestBase class

    Add override ResisterServices 

    Create something like PrepareGraph with usage of TestBase.Setup class

    Write your mehtods.

    I will not describe how steps 1 - 4 may look, as it is pretty obvious, but step 5 and 6 at C# level may look like this:

    public class SOOrderEntrySDExtTests : TestBase

    {

        protected IPXCurrencyService CurrencyService;

        protected IFinPeriodRepository FinPeriodService; … more

  • How to catch all MySQL queries generated by Acumatica

    Hello everybody,

    finally I found out how to catch all queries to MySQL server, generated by Acumatica. Well, in context of My SQL as usually people work more with MYOB, but under the hood MYOB is Acumatica.

    Typical schema of Acumatica <-> MySQL connection looks like this:

    In order to get generated MySQL queries, you may need some proxy service, which will intercept queries. You can use MySQL proxy, but instead of MySQL proxy I suggest to use Neor Profile SQL as it has much more convenient UI:

    In order to achieve such catching of all My SQL queries, you'll need following steps:

    Install Neor Profile SQL.

    In your Acumatica web.config make following change:

      < … more

  • How to point MySQL to another port then 3306

    Hello everybody,

    today I want to describe how to point to non standard port in My SQL for Acumatica.

    Below goes fragment from my Web.config

        <remove name="ProjectX" />

        <add name="ProjectX" providerName="System.Data.SqlClient" connectionString="Server=localhost;Port=4040;Database=PXProjectionMySql2;Uid

    you can use this knowledge for having multiple MySQL instances on the same machine and for catching generated SQL queries. more

  • How to install MySQL proxy

    Hello everybody,

    quick post on how to install MySQL proxy. You may be puzzled why it is needed? Because MySQL proxy allows you to track all generated SQL by MySQL. As of now, you can catch generated SQL for SQL server with SQL Server Request Profiler. But in order to achieve it for MySQL, you'll need to use MySQL proxy.

    So, first step will be download MySQL proxy archive and unzip it to some folder on your drive. 

    Then in command prompt ( not in powershell ) execute something like this:

    sc create "Proxy" DisplayName="MySQL Proxy" start="auto" binPath="d:\Install\mysql-proxy-0.8.5-windows-x86-32bit\bin\mysql-proxy-svc.exe"

    And then this:

    net start proxy

    Those two commands will allow … more

  • How to use FBQL in PXProjection

    Hello everybody,

    Recnetly I had a need to create PXProjection and wanted to use in declaration of it not SelectJoin, but FBQL SelectFrom with combination of InnerJoin. Finally I've got something like this:

    [PXProjection(typeof(SelectFrom<SOOrder>.InnerJoin<SOLine>.On<SOOrder.orderType.

        IsEqual<SOLine.orderType>.And<SOOrder.orderNbr.IsEqual<SOLine.orderNbr>>>))]

    public class SalesOrderLines

    {

    }

    Nothing fancy, but during initial coding error messages were a bit confusing

    more

  • How to use PXDBScalar with PXProjection

    Hello everybody,

    today I want to write a few words about how to use PXDBscalar in connection with PXProjection and is it possible at all.

    First of all want to say that it's defientely a possiblity. Take a look on this sample of implementation:

    [Serializable]

    [PXProjection(typeof(Select2<FABookBalance,

    LeftJoin<FABookHistory, On<FABookHistory.assetID, Equal<FABookBalance.assetID>,

    And<FABookHistory.bookID, Equal<FABookBalance.bookID>,

    And<FABookHistory.finPeriodID, Equal<IsNull<FABookBalance.currDeprPeriod, FABookBalance.lastPeriod>>>>>,

    InnerJoin<FABook, On<FABook.bookID, Equal<FABookBalance.bookID>>>>>), new Type[] { typeof(FABookBalance) })]

    [PXCacheName(Messages. … more

  • how to make redirects in Acumatica and popup warning

    Hello everybody,

    today I want to write a newer post about how to give an opportunity to user go to some link from Acumatica. As I've mentioned in https://blog.zaletskyy.com/types-of-redirects-in-acumatica, redirections are implemented as exception. Let consider next simple code, by which you can implement it:

    In your page (in our example this is SO301000) a button will appear:

    If user will click to this button, then he'll immediately receive requested data right in main window:

    This approach has the disadvantage - the user will lose all unsaved data. So let's change our code to warn the user about it:

      Now, after the user clicks on the "Learn More" button, a popup window … more

  • When to use PXConnectionScope, and when to avoid it

    Hello everybody,

    today I want to leave a very short note-reminder. Mainly for myself, but maybe someone else may benefit from it also. 

    In Acumatica there is wonderful scope: PXConnectionScope. It is needed for the following situation: if you need to raw data from database eliminating cache. For this purposes is also fine PXSelectReadOnly, but if you want to open a new connection, and read from db raw data, then it's better to read them through PXConnectionScope. 

    Also want to mention few rakes, which stolen from me enormous amount of time.

    If you want to read some data during RowSelecting or FieldSelecting, potentially it may be a good idea to use PXConnectionScope

    If you want to … more

  • Getting Combo-box values set for REST API

    Hello everybody,

    today I want to share idea on how to get getting Combo-box values set for REST API.

    As usually values of comboboxes values are just hardcoded in web api calls, but sometimes it may be necessary to load them from Rest API, for example for cases if you want to target multiplve versions of Acumatica. For such a purpose I'd suggest to create Graph, which via reflection will read values from dlls. Quite similar to what Acumatica team does. 

    Below goes source code of graph, which via reflection loads data:

    using PX.Data;

    using System;

    using System.Collections;

    using System.Reflection;

    namespace LA

    {

        public class ListAttributesInq : PXGraph<ListAttributesInq>

         … more

  • Create payment proc

    Hello everybody,

    today I want to write a few words about method CreatePaymentProc in graph SOOrderEntry.

    Among different features of this method, want to describe that it have for some reason out parameter! Take a look on it's declaration:

    public virtual void CreatePaymentProc(SOOrder order, out PXGraph target, string paymentType = ARPaymentType.Payment)

    {

    as you see, it accepts as a parameter PXGraph. Inside of open part of Acumatica source code there is only one more file, which has similar staff: ServiceOrderCore. Take a look on it:

    public static void CreatePrepayment(FSServiceOrder fsServiceOrderRow, FSAppointment fsAppointmentRow, out PXGraph target, string paymentType =  … more

  • Acumatica Application Architecuture

    Hello everybody,

    today I want to leave a short note about Acumatica Architecture. Take a look on this picture:

    As you can see from the schema business logic controllers is kind of single source of truth. Acumatica doesn't have dependencies between UI and Web services. Also it means, if you hide something from UI on the page, it will be also hidden from Mobile app.

    But want to say about few exceptions as well.

    Suppose following scenario. You make a graph, and you know for sure, that from UI standpoint, it's logicall to load some visualization data, but from API call there is no reason to call some piece of code. How to inform Acumatica about it?

    For this purpose you can use … more

  • Acumatica summit 2020

    Hello everybody,

    today I want to write a few words or kind of summary of Acumatica summit 2020. 

    First of all want to say that for me it was very interesting to see people which have big or even huge desire to make Acumatica grow. 

    And also want to post some photos. 

    Hackathon

    When I thought about Hackathon, I didn't thought that I'll be part of a winning team. I thought that I will have some fun. Make some customization for Acumatica, congratulate the winner and will go home. But to my surprise, here is what I've got:

    well, not only myself, but other teammates with me in team Theta. Harsha, Dhiren, Yuriy and Spencer. Guys, it was a huge pleasure to play with you on the one team! … more

  • How to display Green image status

    Hello everybody,

    I want to leave a short note regarding showing successful validation of some operation. Background is the following. Imagine, that you need somehow validate value entered in some checkbox. And in case if validation is successful, you'd like to show green sign near your text entry. I mean something like this:

    How to achieve it?

    1. Create field in DAC or DAC extension similar to shown below:

    public abstract class creditGreenStatus : BqlBool.Field<creditGreenStatus> { }

    [PXUIField(DisplayName = "", Visible = false)]

    [PXBool]

    [PXDefault(false, PersistingCheck = PXPersistingCheck.Nothing)]

    public bool? CreditGreenStatus { get; set; }

    2. Create markup on the page like … more

  • Generic template methods in Acumatica

    Hello everybody,

    today I want to write a few words about Generic template methods in Acumatica. 

    In Acumatica there is such a greate feature as convention over configuration. For example if you want to add reaction in Acumatica on changing the field Description of SOOrder you may do something like this:

    protected void SOOrder_OrderDesc_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)

    {

    }

    and also it's relatively convenient, but inside of that method you'll need to make some casting operations. For quite a long time Acumatica allows to have new format with usage of underscore:

    protected void _(Events.FieldUpdated<SOOrder, SOOrder.orderDesc> e)

    {

        

    }

    And take a note of … more

  • How to assign random values to each row in SQL for Acumatica

    Hello everybody,

    recently during testing of some logic for me it was necessary to assign some random values to table VendorPart in Acumatica. In order to achieve it, I've created such a script:

    update VendorPart set NetPrice = (ABS(CHECKSUM(NEWID()))% 3000.25 + 1.1 + 1), ListPrice= (ABS(CHECKSUM(NEWID()))% 3000.25 + 1.1 + 1)

    where NetPrice = 0 and ListPrice = 0

    of course such a query will not satisfy all requirements for random numbers generator, but in scope of my business scenario it was better then assign the same value to both columns.

    Summary

    If you want to have some diversity in digits for your values, use NEWID function for assigning values. more

  • Import data in Acumatica

    To import data (Customers for instance) from .xlsx format we need to make 3 actions:           

    Create Data Provider

    Create an Import Scenario

    Make an Import by Scenario

    1: First of all, before we will start do all those steps, we need to have .xlsx file with customers and such fields at least on the first row as a heading row:

    After that when we’ve checked Customers.xlsx file, click on the menu button and choose Integration tab.

       

    Afterwards on the Profiles subheading click Data Providers

    In the *Name field type the name of the future Data Provider to/from Excel format (Import/Export Customers to Excel) and in the next field  - * Provider Type: choose … more

  • Export data from Acumatica

    Hello everybody,

    I want to describe how to export data from Acumatica. 

    To export data (Customers for instance) to .xlsx format output we need to make 3 actions:

    Create a Data Provider

    Create an Export Scenario

    Make an Export by Scenario

    1. First of all, before we will start do all those steps, we need to create .xlsx file with such fields at least on the first row as a heading row:

    After that when we’ve created Customers.xlsx file, click on the menu button and choose Integration tab.

    Afterwards on the Profiles subheading click Data Providers:

    In the *Name field type the name of the future Data Provider to Excel format (Import/Export Customers to Excel) and in … more

  • Acumatica Sequence of Events

    Hello everybody,

    today I want to leave a picture, which shows sequence of events in Acumatica depending from happening scenario. 

    Sometime I'm getting questions from people like this: why after update of record I don't have my FieldDefaulting executed?

    Or why deletion of record doesn't trigger my RowUpdated event?

    Or why Save doesn't initiate RowInserting event and so on. 

    If you take a look on the picture you'll be able to notice that those questions easily addressed. 

    That picture shows that during update, you have executed FieldUpdating, FieldVerifying and FieldUpdated executed. But you will not get FieldDefaulting executed, 

    because it was executed before in Insert event. 

    Below … more

  • How to speed up database of Acumatica with RAID-10

    Hello everybody,

    today I want to leave a note regarding performance of database of Acumatica. Once I had request of possible speeding up of operations with DB.

    The most practical advice which you will hear will be put log files on one SSD drive, and mdf file on another SSD drive.

    But what to do, if that is not enough? What are other ways of speeding up DB in itself.

    As the answer I'd suggest to consider RAID-10 technology.

    Below goes simplest explanation of RAID-10 explanation and how it works:

    This picture says following:

    File MyFileN1.txt will be stored in four hard drives. Two times on RAID-1 array and two times on RAID-1 array, and splitting of it will be done through RAID-0 … more

  • Property from CROpportunity is not loaded

    Hello everybody,

    today I want to leave short note on issue with CROpportunity DAC class.

    For quite a few times I've noticed that someone adds field to CROpportunity, but later notices that field is lost either on moment of loading from database, or lost during persisting record to database.

    Reason for such weirdness is that starting from some Acumatica version CROpportunity got following declaration:

    [System.SerializableAttribute()]

    [PXCacheName(Messages.Opportunity)]

    [PXPrimaryGraph(typeof(OpportunityMaint))]

    [CREmailContactsView(typeof(Select2<Contact,

    LeftJoin<BAccount, On<BAccount.bAccountID, Equal<Contact.bAccountID>>>,

    Where2<Where<Optional<CROpportunity.bAccountID>, … more