Contents tagged with Acumatica

  • How to use F-BQL view instead of PXSelect

    Hello everybody,

    today I want to leave a short note on how to use F-BQL version of PXSelect in Acumatica.

    In past it was common to have this line of code in your graph:

    public PXSelect<Student1> Students;

    In new F-BQL introduced new construction, SeleftFrom. Proper way of using it is this:

    public SelectFrom<Student2>.View Students;

    Take notice of suffix .View. Without that suffix you'll not get proper F-BQL view. And Acuminator will give you this warning:

    So if to summarize, don't forget to add suffix .View

    more

  • How to download DAC schema browser

    Hello everybody,

    here is just short post on how to download DAC Schema browser which I recently opensourced.

    You'll need two steps:

    Navigate in your browser to link https://github.com/YuriyZaletskyy/DacSchemaBrowser

    Click on Star as displayed on screenshot (this is optional step):

           4. Right mouse click AcumaticaTablesFixed19x100x0122.zip

           5. Save customization wherever you wish

           6. Publish on your local instance

    That particular file is intended for Acumatica version 2019 R1 build 0122, but it should work on higher versions as well. Later on I'll add lower versions as well. more

  • How to get list of all Acumatica tables

    Hello everybody,

    today I want to share single line of code, which I found recently while digging Acumatica source code with reflector. Sometime you may need to know if there is some or antoher Acumatica table available. For example if you create some customization plugin. How to find out if there is some table? You can use following line of code for this purpose:

    using PX.Api.Soap.Screen;

    ............

    var acumaticaTables = ServiceManager.Tables;

    Variable acumaticaTables will have a list of Acumatica tables.

    more

  • Configuration Error for Acumatica T100 training

    Hello everybody,

    once upon a time Acumatica requires for certified developers to pass over certification again. 

    As obedient person I decided to install T100 sample application over Acumatica Framework Configuration ( don't mix with Acumatica ERP Configuration ). Then I navigated to just installed application, and here is what I've seen:

    Server Error in '/T100a' Application.

    Configuration Error

    Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. Parser Error Message: The connection string name is missing for the … more

  • How to call action Cancel in Acumatica

    Hello everybody,

    Today I want to leave a short notice on how to call Cancel button of Acumatica from inside C# code:

    graph.Clear();

    That is it, Clear method is binded to button Cancel in Acumatica. Besides that Clear method will reload current data record from database and rolls back changes of Cache objects. more

  • PXUIRequired attribute usage in Acumatica

    Hello everybody,

    today I want to say a bit more about usage of attribute PXUIRequired as previous article on my blog wasn't very easy to follow by some of my readers.

    Take a look on presented code sample:

    public class sOOrderType : Constant<string>

    {

    public const string SOOrderType = "SO";

    public sOOrderType() : base(SOOrderType)

    {

    }

    }

    public class SOOrderExt : PXCacheExtension<SOOrder>

    {

    [PXMergeAttributes(Method = MergeMethod.Append)]

    [PXDefault]

    [PXUIRequired(typeof(Where<SOOrder.orderType, Equal<sOOrderType>>))]

    public virtual string CustomerOrderNbr { get; set; }

    }

    As you can see, besides attribute PXUIRequired it has declaration of constant value "SO". … more

  • How to extend Persist of your own graph in Acumatica

    Hello everybody,

    here I want to leave a short line on how to extend Perist method of your own graph.

    I described once long time ago how to override Save action in your extension, but sometime it can be needed to override Persist in your own graph.

    Sometime it can be necessary. Below goes sample of code for this purpose:

    public override void Persist()

    {

    //Some other custom business logic

    base.Persist();

    }

    Here you go.

    more

  • How to compare Acumatica objects without ObjectsEqual

    Hello everybody,

    Long time ago I made a post on how to extend if needed method  ObjectsEqual in Acumatica.

    today I want to extend my answer a bit more and share with you class OneLevelComparer. With help of this class you may check if some object was changed without need of typing all fields of DAC class. Take a look on the class itself:

    /// <summary>

    /// Comparison of two objects on equality based on reflection. 

    /// Doesn't support inner collections, objects.

    /// </summary>

    public static class OneLevelComparer

    {

    // Item1: property name, Item2 current, Item3 original

    public static List<Tuple<string, object, object>> Differences<T>(T current, T original)

    {

    var diffs = new  … more

  • Closest possible to database approach in Acumatica

    Hello everybody,

    today I want to leave another post about internals of Acumatica, about which you may heard something like "Never try it at home". In another words, sometime you may need to do the following in Acumaitca:

    Insert directly into database ( for this purpose I'd recommend you to use PXDatabase.Insert )

    Alter Table

    Alter Schema of Table

    Create column

    Drop column

    Drop Table

    .... this list is not exhaustive

    and any other system level activities. By default and for SOLId SOLID SOLID reasons you can't achieve it. But sometime you may need it. 

    Below goes sample of code, which you can use for setting identity insert to on, and then execute some update onf the table, and … more

  • How to call RecordCCPayment action from Screen Based Web API call in Acumatica for Payments and applications screen

    Hello everybody,

    today I want to write a few words with code samples on how to work with Screen based web API in Acumatica. 

    Stage preparation

    Before you go, first step that is needed is to have Acumatica instance ready. So install Acumatica with sales demo database.

    As mentioned in the title of the article, I'm going to work with "Payments and Applications" screen ( AR302000 ) and with Action Record CC Payment: 

    As usually in cases of WEB API calls in .Net, you'll need somehow to create Web Reference. 

    For Record CC Payment following sequence of Actions is needed.

    In Acumatica instance navigate to page AR302000, and click there on Help -> Web Service:

    2. Copy into clipboard … more

  • 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