Blog

Here I document some issues for searching of which I spent more then 15 minutes

  • LastModifiedDateTime has wrong datetime information

    Hello everybody,

    today I want to share interesting use case which raised recently when dealt with syncrhonization of records between Magento and Acumatica.

    I had following declaration:

    #region LastModifiedDateTime

    [PXDBDateAndTime()]

    [PXUIField(DisplayName = "Last Modified Date Time")]

    public virtual DateTime? LastModifiedDateTime { get; set; }

    public abstract class lastModifiedDateTime : PX.Data.BQL.BqlDateTime.Field<lastModifiedDateTime> { }

    #endregion

    and for my disappointment as well as disappointment of Magento developers we had to add some hours shift to each call, in order to filter out properly by Last modified Date time.

    One of the solutions was to add one more flag to … more

  • New SQL Server 2016 features to use in Acumatica

    Hello everybody,

    today I want to write about new additions for SQL Server T-SQL language, which are there starting from 2016. It is create or alter syntax.

    In the past, if you've made some custom SQL view, it was needed to have constructions like this ( pseudo code ):

    if view ( stored procedure, function, trigger ) exists

         create view ( stored procedure, function, trigger )

    else

       alter view ( stored procedure, function, trigger )

    But startring from 2016 SP1 you can use following syntax ( pseudo code ):

    Create or alter view ( stored procedure, function, trigger ).

    Or in code form it may look like this:

    create or alter procedure yourProcedure

    as

    begin

     print (1)

    end;

    go … more

  • SelectFrom for usage in View.Select

    Hello everybody,

    I want to leave a short note on how to use SelectFrom for legacy code, and pass it in View.Select for Acumatica newer versions. 

    var cmd = new SelectFrom<PartsCatalog>.

        InnerJoin<INSiteStatus>.On<Use<PartsCatalog.inventoryID>.AsInt.IsEqual<Use<INSiteStatus.inventoryID>.AsInt>>.View(this);

    var s = (currentFilter.PageNbr ?? 0) * (currentFilter.PageSize ?? 0);

    int startRow = s > 0 ? s : PXView.StartRow;

    int totalRows = 0;

    int maxRows = (currentFilter.PageSize ?? 0) == 0 ? PXView.MaximumRows : currentFilter.PageSize ?? 0;

    var list = cmd.View.Select(new[] { currentFilter }, null, PXView.Searches,

        PXView.SortColumns, PXView.Descendings, PXView.Filters, ref  … more

  • How to overrde Authorize CC Payment Action in Acumatica

    Hello everybody,

    as it was mentioned in one of my previous blog posts, regarding overriding base actions of Acumatica graphs, family of graph extensions grows and grows. 

    Today I want to share one more code snipped whic you can use for extending modifing Acumatica actions. Below goes code fragment, which you can use for modification of Authorize CC Payment:

    public class PaymentTransactionExt : PXGraphExtension<PaymentTransaction, SOOrderEntry>

    {

        [PXOverride]

        public virtual IEnumerable AuthorizeCCPayment(PXAdapter adapter, Func<PXAdapter, IEnumerable> baseFunc)

        {

            

            var result = baseFunc(adapter);

            

            return result;

        }

    }

    Of what I … more

  • Test credit card numbers

    Hello everybody,

    below goes repost of credit cards numbers, taken from here.

    Peach Payment Test Cards

    Note: Card associations that are available to you depends on the country you do business in, please contact Peach for more information. Please use this guideline, in addition to our online documentation to help with your technical integration.

    VISA

    Number: 4012888888881881 or 4111111111111111

    Expiry: Any future date

    Verification: 123

    This 4111111111111111 card simulates 3DSecure in EXTERNAL mode

     

    VISAELECTRON

    Number: 4012888888881881

    Expiry: Any future date

    Verification: 123

     

    MASTER

    Number: 5105105105105100

    Expiry: Any future date

    Verification: 123 … more

  • How to override ShopRates action in Sales Orders form

    Hello everybody,

    today I want to leave a short post on how to override Shop rates Action in Acumatica. 

    I mean this button:

    Below goes C# code, with which you can achieve it:

    public class SOOrderEntryExt : PXGraphExtension<SOOrderEntry.CarrierRates, SOOrderEntry>

    {

        [PXOverride()]

        public virtual IEnumerable ShopRates(PXAdapter adapter, Func<PXAdapter, IEnumerable> baseMethod)

        {

            //your code here

            var retVal = baseMethod?.Invoke(adapter);

            //and possibly here

            return retVal;

        }

    }

    As you can see from the code, life in Acumatica becomes more complex, and if in the past you've used to override directly your actions, now you'll need … more

  • PXLongOperation cleans everything. How to avoid?

    Hello everybody,

    today I want to write a few words about interesting behavior of PXLongOperation.StartOperation in Acumatica.

    On the glance that looks pretty simple and straightforward. You have something processing of which will take a long time? Use PXLongOperation.StartOperation. So imagine, you extend ARPaymentEntry graph like this:

    public PXAction<ARPayment> StartOperation;

    [PXProcessButton]

    [PXUIField(DisplayName = "Some long running operation")]

    protected virtual IEnumerable startOperation(PXAdapter adapter)

    {

       

       PXLongOperation.StartOperation(Base, () => SomeLongRunningOperation(Base.Document.Current)); return adapter.Get();

    }

    In this case you may notice … more

  • How to make dynamic List with check boxes in Acumatica

    Hello everybody,

    today I want to share with you a piece of code, with help of which you can get list of all activer order types in Acumatica and also you'll get a chance to select those types with checkbox. Take a look on a screenshot below:

    how to achieve this?

    Code below without description of DAC class gives you this:

    protected virtual void _(Events.FieldSelecting<SetupClass, SetupClass.orderTypes> e)

    {

        if (e.Row == null)

        {

            return;

        }

        var orderTypes = SelectFrom<SOOrderType>.Where<SOOrderType.active.IsEqual<True>>.View.Select(this).Select(a => a.GetItem<SOOrderType>())

            .ToList();

        var allowedValues = orderTypes.Select(a => a.OrderType). … more

  • How to insert VARBINARY data in MS SQL for Acumatica

    Hello everybody,

    sometime it is needed to insert some binary information in one or another table inside of Acumatica. Quite often developers just modify existing record in table UploadFile or UploadFileRevision.

    But I don't like such approach, as it is prone to errors and potentially can harm some of your existing data. That's why I propose to use cast operator of MS SQL. Take a look at following example:

    insert into UploadFileRevision(CompanyID, FileID, FileRevisionID, Data, Size, CreatedByID, CreatedDateTime, CompanyMask) values

    (2, '35b15ad7-b5c3-4a19-aa77-3a24c046d689', 1, 

    CAST('wahid' AS VARBINARY(MAX)),

    4, 

    'B5344897-037E-4D58-B5C3 … more

  • Comments TODO and HACK in C#

    Hello everybody,

    today I want to leave one more note, which you can use for boosting your productivity.

    Imagine following scenario. On the meeting with customer you've got some list of to do points. You have them on your email. You've made some research, and found that you need to make changes to 5 C# files. How not to forget about all of those files?

    On rescue comes two comments in C#:

    TODO

    HACK

    Leave those comments in your 5 files -> save all files -> Open Task List, and you'll see something like this:

    As you can see from presented screenshot, after you leave TODO or HACK comments in 5 C# files, you'll be in perfect position of usage of code.

    What is even more interesting, … more

General information

Greetings to everybody stopping at my blog. Purpose of this web site is to be google of my brain. Everything I found useful, or of possible beneficial for usage in future I've save here at this blog

Contact information

If you want to contact me more on any subject printed at this web stie, you can email me: zaljur1989(at)gmail.com

Job information

If to speak in general, I'm developer. For now I work as team lead in company GlobalLogic.