Contents tagged with Acumatica

  • Submition types in Acumatica

    Hello everybody,

    today I want to leave a really short notice on how you can submit data into Acumatica. There are three ways:

    Contract-based REST API

    Contract-based SOAT API

    Screen-based SOAP API

    Historically the first was screen based SOAP API, and with time two others were added. Later on I hope to add description of others as well. more

  • Where log of Visual Studio is located

    Hello everybody,

    today I want to leave a short note on where to search for log file of Visual Studio. 

    It lives here:

    C:\Users\{USER}\AppData\Roaming\Microsoft\VisualStudio .....\{visual studio version}\ActivityLog.xml

    Whenever I speak about log files with any kind of developer, I see round eyes and trembling voice with a question, why on earth should I look into log file?

    The reason is simple, sometime you may get error message like this: "Error HRESULT E_FAIL has been returned from a call to a COM component" during adding reference to your class library. 

    What may stand behind that error message? No ideas? The same was with me, but after looking into log file, we have found there … more

  • How to refresh cache of Acumatica

    Hello everybody,

    today I want to leave a comment on how to refresh cache of Acumaitca.

    As usually I start with this method:

    ViewName.View.RequestRefresh();

    But I found that it not always work. For my surprise RequestRefresh not works for some reasons. I think reason for this may be that Acumatica has two caches: caching of data and caching of queries.  

    If that is the case, I use another approach ( more hardcore ) 

    ViewName.View.Cache.Clear(); // clearing cached data

    ViewName.View.Cache.ClearQueryCache(); // clearing cached queries.

    Second approach works a bit better, because it clears not only data, but also clears cached queries, and as outcome clearing results more

  • How to display images in grid of Acumatica

    Hello everybody,

    today I want to leave a short post on how to display images in grid of Acumatica. 

    I'll demonstrate it on sample of Sales Orders pages, which is known as SO301000.

    End result will look like this:

    In order to make it work, I've done the following:

    Created extension to SOOrderEntry and added there some kind of reading of url images

    Created DAC class for demo purposes

    Added few controls and css/js on customized so301000 page.

    Now a bit more details. For SOOrderEntry I've created following extension:

        public class SOOrderEntryExt : PXGraphExtension<SOOrderEntry>

        {

        public PXSelect<SOImageItem> Images;

        protected virtual IEnumerable images() … more

  • How to use Autofac in Acumatica with global graph and single registration

    Hello everybody,

    today I want to leave a short notice on how to use Autofac in Acumatica, but with single registration. In this article I've descirbed how to use Autofac for resolving interface < -- > class implementation. 

    But one of my collegues Deebhan Hari pointed that with my usage registration of classes will happen on each roundtrip and for each graph leading to potential memory leack.

    Definetely not something, we would like to have. After small conversation, we managed to add to Autofac singleton, which allowed us to have situation when only once per lifetime of the process Autofac 

    registers class only once.

    using System;

    using PX.Data;

    using Autofac;

    namespace  … more

  • How to debug Acumatica with dnSpy

    Hello everybody,

    today I want to share with you few words about debugging of Acumatica. There are plenty of wonderful posts for doing this with help of already provided PDB files of existing graphs and first of all I definetely recommend to use them.

    But there are scenarios when default pdb provided is not enough. One of recent examples when I faced it was debugging of web api rest calls. 

    Below I'll provide you with steps, which you can accomplish in order to debug error stack trace like this ( screenshot from postman ):

    how many times in your life you looked on it and said: I'd like to debug that code, but I don't have source code! What will be next steps? Open case in Acumatica, … more

  • How to work with filters applied to grid in Acumatica

    Hello everybody,

    today I want to describe how to work with Filters, that applied to grid in Acumatica page.

    For demonstration purposes I'll use Requisition form. 

    So, first of all, I want to say that dealing with Filters you'll need .View.GetExternalFilters() method.

    At requisition form graph extension you can get it like this:

    List<PXFilterRow> filters = Base.Lines.View.GetExternalFilters()?.ToList() ?? new List<PXFilterRow>();

    Demonstrated line of code will give you list of applied filters, or empty list, if no filters were applied to grid.

    Take not on how filters look like in debugger:

    honestly speaking, applied filters look very similarly to applied ODATA protocol. On my … more

  • How to react on clicking on Abort button in Acumatica processing screen

    Hello everybody,

    today I want to leave a notice with proposal on how to program reaction on clicking of Abort button in processing screen.

    Recently it become needed for me to program some functionality to happen after user clicks on button Abort of processing screen. 

    In my case I needed somehow to program exit from some threads which were running in parallel and I needed to finish one iteration of threads and then exit from each of those threds.

    One more point was that just terminating of threads was also a bad idea. After a while I have found IPXCustomInfo interface. With that interface you can gain control on what to do in case of user 

    clicking on Abort button. In my case I did … more

  • Create view if not exists in Acumatica customization

    Hello everybody,

    today I want to leave a short post on how to create some custom view in Acumatica Customization if that view doesn't exist:

    if not exists (select * from sysobjects where name='CustomerSelector' and xtype='V')

    begin

    exec (

        'CREATE view [CustomerSelector] as 

    select Distinct b.CompanyID, cc.Phone1, a.City, a.CountryID, b.TaxRegistrationID, c.CuryID, cc.Salutation, c.CustomerClassID, b.Status

    from BAccount b inner join customer c on b.BAccountID = c.BAccountID inner join [Address] a 

    on a.BAccountID = b.BAccountID inner join Contact cc on cc.BAccountID = b.BAccountID'

    )

    end

    This code will create view CustomerSelector only if such view doesn't exist in … more

  • How to read information from Acumatica chunk by chunk

    Hello everybody,

    today I want to leave short fragment of code, which anybody can use for processing records in Acumatica chunk by chunk. By default, everybody in Acumatica including myself uses Select method. Select works quite 

    well, but has one limitation: it reads all information that satisfies filtering conditions. But imagine that you need to read not all records, but some limited set i.e. top 5000 records.

    Next code fragment shows how to read from table CSalesOrder top 5000 records:

    PXSelectReadonly<CSalesOrder,

                        Where<CSalesOrder.CustImported, Equal<False>,

                            And<CSalesOrder.CustomerError, IsNull>>>.SelectWindowed(this, 0, 5000).

            … more

  • How to add parallelism to Shipments creation in Acumatica

    Hello everybody,

    Today I want to leave short note on new feature of Acumatica: ParallelProcessingOptions. Main purpose of that class is adding paralelism to processing screens. Take a look on it's declaration:

    public abstract class PXProcessingBase<Table> : PXSelectBase<Table>, IPXProcessing, IPXProcessingWithCustomDelegate where Table : class, IBqlTable, new()

     {

       . .  .

       public System.Action<PXParallelProcessingOptions> ParallelProcessingOptions;

       . .

    }

    As you can see, ParallelProcessingOptions is a member of PXProcessingBase, while PXProcessingBase is a parent for PXProcessing. For Acumatica developers it means that starting from 2018 R2 you can easily turn on parallel … more

  • How to filter customer by Email in Acumatica API with Postman

    Hello everybody,

    I want to add few more words about Acumatica API usage.

    Recently I was asked on how to find customer by email in Acumatica. And I was asked to provide example of Postman functionality. That wasn't easy task, first of all because I'm not very skilful in Postman, but after few more efforts I was able to deliver Postman url.

    But first of all let's consider how to configure Acumatica.

    Acumatica configuration.

    First of all, you'll need to either use your own endpoint, or default. For learning sake I recommend you to use your own. Also add customers screen to it. First gif visualizes this process:

    I want to add few comments on this visualtion. Object name, that I gave: … more

  • Addition to PXDatabase.Update in Acumatica

    Hello everybody,

    today I want to share a new feature for me in Acumatica from code standpoint. 

    So, suppose that you want to update some column in Acumatica database, but you want to avoid graph creation, loading necessary fields, and all that you need to do is just update column. For example over adding some value.

    You can't achieve it with simple call to

    PXDatabase.Update<>()

    Or if you can, then let me know, because I didn't find the way how to do it. 

    But instead I found another new method in Acumatica which is named PXUpdate.

    For example you can use this method for adding to each email in table contact value ".someaddition"

    PXUpdate<Set<Contact.eMail, Add<Contact.eMail,  … more

  • How to get companyID in Acumatica 2

    Hello everybody,

    today I want to leave another post related to getting Acumatica. There is one more way of gettinc current company id. For this purpose you can use class of Acuamtica named SharedFunctions.

    It has plenty of interesting staff, as well as getting Current company id. Take a look on it:

    var companyId = SharedFunctions.GetCurrentCompanyId();

    more

  • How to interfere with Acumatica after publish of customization

    Hello everybody,

    today I want to tell you about interesting class in Acumatica: CustomizationPlugin. Take a look on how reflector shows it's source code:

    namespace Customization

    {

      public abstract class CustomizationPlugin

      {

        public virtual void OnPublished()

        {

        }

        public virtual void UpdateDatabase()

        {

        }

        public void WriteLog(string msg)

        {

          CstPublishLog.WriteLog(msg);

        }

      }

    }

    As you can see, this class has three methods:

    OnPublished

    UpdateDatabase

    WriteLog

    Each of those events allows you to update Acumatica after some events happening. For example after publish, on stage of updating database, and also you can use it … more

  • How to override properly CreatePaymentProc method of SOOrderEntry graph in Acumatica

    Hello everybody,

    today I want to leave short note on how to override and call CreatePaymentProc method of Acumatica which I discovered today with Naveen from Kensium.

    My favorite way of overriding methods in Acuamtica with usage of Action and passing there parameters doesn't work. That is because Acumatica uses in method CreatePaymentProc out modifier. Due to this, delegate declaration is needed. 

    After some efforts and refactorings we found following code that is working:

    public class SOOrderEntryExt : PXGraphExtension<SOOrderEntry>

    {

        public delegate void CreatePaymentBase(SOOrder order, out PXGraph target, string paymentType);

        [PXOverride]

        public virtual void  … more

  • How to increase length of Customer id column

    Hello everybody,

    today I want to describe interesting case. Recently I was asked to increase length of Customer ID at page AR303000.

    As usually such tasks can be achieved via creating extension to DAC class with setting new length, 

    and with SQL statement that increases length of column. But that is not the case with Customer ID. That is because

    Customer ID is Segmented Selector. And everything related to segmented selectors should be managed 

    at page Segmented Keys page ( CS202000 ). All that is needed to be done is increasing the Length field of segmented keys.

    Other approaches can lead to corruption of segmented keys. Especially if you decide to do it in database with DB scripts.  … more

  • How to shrink database of Acumatica with rebuilding of

    Hello everybody,

    today I want to leave another portion of SQL Server optimization for Acumatica database. In case if your db become huge, and you want to make it smaller, you can try following SQL code:

    DECLARE @Table NVARCHAR(128)  

    DECLARE @Database NVARCHAR(128)

    DECLARE @Command NVARCHAR(500)

    PRINT N'Shrinking database files'

    DBCC SHRINKDATABASE(0)

    PRINT N'Rebuilding all indexes'

    SET @Database = DB_NAME()

    SET @Command = 'DECLARE TableCursor CURSOR FOR SELECT ''['' + TABLE_CATALOG + ''].['' + TABLE_SCHEMA + ''].['' + 

        TABLE_NAME + '']'' as TableName FROM [' + @Database + '].INFORMATION_SCHEMA.TABLES 

        WHERE TABLE_TYPE = ''BASE TABLE'''   

    EXEC (@Command)  

    OPEN  … more

  • How to find sizes of tables in Acumatica

    Hello everybody,

    today I want to share with you SQL statement that may help you to find sizes of tables occupied by Acumatica. It goes below:

    SELECT 

        t.NAME AS TableName,

        s.Name AS SchemaName,

        p.rows AS RowCounts,

        SUM(a.total_pages) * 8 AS TotalSpaceKB, 

        CAST(ROUND(((SUM(a.total_pages) * 8) / 1024.00), 2) AS NUMERIC(36, 2)) AS TotalSpaceMB,

        CAST(ROUND(((SUM(a.total_pages) * 8) / 1024.00 / 1024.00), 2) AS NUMERIC(36, 2)) AS TotalSpaceGB,

        SUM(a.used_pages) * 8 AS UsedSpaceKB, 

        CAST(ROUND(((SUM(a.used_pages) * 8) / 1024.00), 2) AS NUMERIC(36, 2)) AS UsedSpaceMB, 

        (SUM(a.total_pages) - SUM(a.used_pages)) * 8 AS UnusedSpaceKB,

        CAST(ROUND(((SUM( … more