Contents tagged with Acumatica

  • How to use column name in DB that differs from field name in DAC class

    Hello everybody,

    today I want to leave a short workaround for the following case:

    you have DAC class, with column Data, but in db you have column BlobData. How to map your BlobData on Data? For such case you can use attribute DatabaseFieldName.

    Take a note, how Acumatica used it:

    [PXDBBinary(DatabaseFieldName = "Data")]

    public virtual byte[] BlobData { get; set; } more

  • How to send email via Acumatica notifications mechanism

    Hello everybody,

    Today I want to share a note on how to send email via Acumatica notifications mechanism:

    var sender = new NotificationGenerator

    {

        To = "someone@example.com",

        Subject = $"Subject information {DateTime.Now:d}",

        Body = "Body od message",

        BodyFormat = EmailFormatListAttribute.Text

    };

    sender.Send();

    With such code, Acumatica will send email.

    more

  • Notes on Acumatica developers summit 2018

    Hi all,

    Recently I visited virtual developers conference for Acumatica.

    Here I want to document some details that were mentioned during that summit.

    First of all, I'd like to say that idea from Gabriel Michaud about making some global functionality for each page.

    Using PXGraph extension for creating a global button

    Consider for example how to implement a global button using PXGraphExtension:

    public class GloalGraphExtension : PXGraphExtension<PXGraph>

    {

        public override void Initialize()

        {

            if (!string.IsNullOrEmpty(Base.PrimaryView))

           {

               //Add a "Test" button in the toolbar    

               Type primaryViewItemType = Base.Views[Base.PrimaryView]. … more

  • Acumatica developers conference 2018 part 1

    Hello everybody,

    I want to summarize what I've seen and heard at latest Acumatica Developers conference.

    First of all, I'd like to say that idea from Gabriel Michaud about using of attributes that can save plenty of time during development.

    Part 1

    Everyday trips and tricks (Magic attributes and BQL operands)

    Lets start. For examle how to make a field required (or visible, or enabled) dynamically:

    Traditional way (old version):

    protected virtual void SOOrder_RowSelected(PXCache cache, PXRowSelectedEventArgs e)

    {

        SOOrder doc = e.Row as SOOrder;

        if (doc == null)

        {

               return;

        }

        if (doc.OrderType == "SO")

        {

              PXDefaultAttribute. … more

  • Select distinct values in Acumatica selector

    Hello everybody,

    today I want to post how to make distinct select from some column in Acumatica.

    So, imagine that you've decided not to normalize some column for Acumatica to SOOrder class. For example like this:

    public class SOOrderExt: PXCacheExtension<SOOrder>

        {

            #region Region

            public abstract class region : IBqlField

            {

            }

            [PXDBString(255)]

            [PXUIField(DisplayName = "Region", Visibility = PXUIVisibility.Visible)]

            public virtual string Region { get; set; }

            #endregion

    Then in other place, if you need to make distinct selector for Region, you can use code like this:

    #region Region

     public abstract class region  … more

  • How to speedup parallel processing in Acumatica

    Hello everybody,

    recently I've get advice from Acumaitca on how to speed up parallel processing of sales orders creation with usage of Multithreading. Their advice was to add following line in web.config:

        <add key="AsyncNumbering" value="true" />

    With that line your Acumatica graphs will have separate numbering sequences which can create some gaps in your numberings, but definetely speed up creation of new lines. more

  • Abbreviations in Warehouse management

    Hello everybody,

    today I want to leave a note on warehouse abbreviations. For me all of them are not easy to keep in mind, so I decided to post them here:

    Abbreviation

    Meaning

    3PL

    Third party logistics

    ADC

    Automated data collection

    APS

    Advanced planning & scheduling

    ASN

    Advanced shipment notifications

    ASRS

    Automated Storage Revival system

    ASP

    Application service provider

    ISV

    Independent software vendor

    AIDC

    Automatic identification and data collection

    BOM

    Bill of material is a list materials required to produce an item

    CCD

    Charged coupled device is a barcode scanner that takes digital image of the barcode instead of … more

  • Some properties of graph in Acumatica

    Hello everybody,

    today I want to mention few interesting properties of Graph in Acumatica:

    IsImport

    IsExport

    IsMobile

    Names are pretty self-explanatory, but let's go a bit deeper.

    IsImport

    Imagine following situation: you created some code in graph, and have huge desire to add some logic, which will be executed only when it is used in Import mode. For example in case of import you'd like not to add discount. How to tell this to Acumatica? For example like this:

    if (!sender.Graph.IsImport) AddDiscount(sender, doc);

    This will tell to Acumatica not to add discount to your entity during Import.

    IsExport

    Another use case. Imagine, that you want some logic to be executed during … more

  • Prediction customization

    Hello everybody,

    here I want to describe in more details what I mean when I say prediction customization.

    As name says by itself, I want to make something that will help you to make predictions. 

    Predictions for what? 

    Acumatica has plenty of entities: invoices, sales orders, employees, taxes, acounts payable, acounts receivable, fixed assets, etc. I want to make customization, that will use some machine learning techniques in order to say something like: in the next month based on history of your your sales, you'll have 2000 sales orders. Or based on your current history, you'll pay 300 000 taxes in the next two months. Or based on your history of hiring, in next three years you'll … more

  • Acumatica clipboard functionality

    Hello,

    today I want to drop few lines about working with copy/paste functionality of Acumatica.

    For full canceling insertion from Clipboard, you can use the following in your graph:

    public override bool CanClipboardCopyPaste()

    {

    return false;

    }

    Also you can use attribute PXCopyPasteHiddenFields. That attribute says that specified fields of the primary DAC of the data view will no be copied when the copy-paste feature is used.

    Another attribute which you can consider is PXCopyPasteHiddenView. This attribute says that cache corresponding to the primary DAC of the data view is not copied when the copy-paste feature is used.

    And one more useful fields in graph itself is … more

  • How to override part of C# code in Automation Steps in Acumatica

    Hello everybody,

    today I want to share one interesting gotcha which took plenty of efforts from mine side in order to understand it.

    Recently I got an assignment to modify behaviour of Create Prepayment action at purchase orders. 

    If to look at CreatePreapyment implementation, it has following part of code:

    if (this.Document.Current == null)

      return;

    this.Save.Press();

    APInvoiceEntry instance = PXGraph.CreateInstance<APInvoiceEntry>();

    if (this.Document.Current.PrepaymentRefNbr == null)

    {

    if to put simply it checks if current purchase order already has a prepayment, and in case if it has, then give to a user error message. 

    Imagine, that you need to modify that behaviour for … more

  • How to override Create Prepayment in Acumatica without usage of custom delegate

    Hello everybody,

    today I want to share with you on how to override Action CreatePrepayment in Acumatica.

    General rule of overriding methods in Acumatica according to T300 manual is like this:

    Create delegate.

    Add [PXOverride] over your method which is named exactly as base method ( in our case CreatePrepayment )

    Add your implementation

    For example you can achieve it like this:

    //Create your delegate

    public delegate void CreatePrepaymentDelegate();

    [PXOverride]

    public void CreatePrepayment(CreatePrepaymentDelegate baseDel)

    {

        // your code of overriding

    }

    Way from manual T300 is perfectly workable, but  I propose you to use feature of .Net which is named Action, … more

  • Creating custom Autonumber which will be auto generated ID in Acumatica

    If you want to create custom Attribute for autonumbering field you need:

    Create Setup page for configuring autonumbering field or maybe you can use existing

    Create Attribute which you'll add to your entity

    Add attribute to field that you need increment 

    Create Setup page for configuration autonumbering field

    Setup.cs like this:

    [System.SerializableAttribute()]

        [PXPrimaryGraph(typeof(CurrencyMaint))]

        [PXCacheName("Your company Preferences")]

        public class Setup : PX.Data.IBqlTable

        {

            #region DocumentRefNbr

            public abstract class documentRefNbr : PX.Data.IBqlField

            {

            }

            protected string _DocumentRefNbr;

            [ … more

  • New class in Acumatica: PXImpersonationContext

    Hello everybody,

    here I want to document new scope in Acumatica: PXImpersonationContext. 

    As often is the case try to look at presented code:

    var thr = new Thread(

                                       () =>

                                       {

                                           try

                                           {

                                               using (new PXImpersonationContext(PX.Data.Update.PXInstanceHelper.ScopeUser)).

    .

    .

    }

                                foreach (var thread in threads)

                                {

                                    lock (thisLock)

                                    {

                                        thread.Start();

          … more

  • Access rights in Acumatica

    Hello everybody,

    today I want to leave a short notice on how access rights work in Acumatica. So, if to enumerate them, there are following access permissions: revoked, select, update, insert, delete. 

    If to enumerate them in the list of smallest permissions to biggest, it will be list like this:

    Revoked - user can't see or edit

    Select - user can see, can't edit

    Update - user can see and edit

    Insert - user can see, edit, create new

    Delete - user can see, edit, create, delete

    So, if you configure permissions, and want to give highest level, then give Delete. But if you want to protect system from accidental deletion, then most probably you'll need give them Select set of … more

  • Some notes on usage Table variables

    Hello everybody,

    today I want to share some fragment of SQL, that I've used for updating tables in Acumatica.

    First of all, I'd like to show table variable that I've created:

    DECLARE @SalesOrderInformation TABLE

    (

      OrderType nvarchar(2),

      OrderNbr nvarchar(12)

    )

    It has nothing special, just two fields: ordertype and ordernbr. 

    I need them as temporar storage for future update. T-SQL allows to use two kind of temporary tables: table variable and temp table, which starts from #.

    I prefer table variables for the following reasons:

    1. Performance. Because limited scope, as usually performance fo table variables is faster then temp tables. 

    2. Temporary tables instead of table … more

  • How to set some value in Acumatica screen and tell about it to Acumatica

    Hello everybody,

    today I want to write a short note about persisting something to Acumatica.

    Sometime it happens that in your code you have something like this:

    SomeDacInstance.Field = somevalue;

    and following workflow:

    User clicks on save, you code is executed, you go in record, refresh page and surprise: somevalue is not there. How to deal with it? In such cases you'll need to use method SetValueExt.

    For example one of readers of mine blog had the following code:

    row.LotSerialNbr = modificado2;

    cache.Insert(row.LotSerialNbr)

    but that approach didn't save value for two reasons:

    1. simple assign of value doesn't tell acumatica cache about any changes.

    2. Inserting something … more

  • Required instead of current in Acumatica

    Hello everybody,

    today I want to fulfill my promise that I gave to one of my readers. 

    He left at mine blog following question:

    How do we use required<> in place of current<> and pass some string constant for selector? That question was asked in context of this article. 

    That is good question and I also want to add that answer on it will be at least to some degree disappointing. First of all, if you work with selectors, you can't use Required. Required is intended for use in Graphs.

    But if you want to use some constant filtering conditions, you don't need Required attribute at all. You can use mechanism of Constants, which works perfectly without Required. 

    Take a look at the … more

  • How to insert correctly new Sales order into Acumatica with external graph

    Hello everybody,

    today I want to write a short notice on how to create new sales order in Acumatica properly.

    So, first of all take not that SOOrder type has two keys. One key is or order type, and second key is for OrderNbr.

    It means that you can't do code like this:

    var newSOrder = sOEntry.Document.Insert();

    sOEntry.Document.SetValueExt<SOOrder.orderType>(sOEntry.Document.Current, sorder.AcumaticaOrderType);

    or actually you can, but later you'll face some issues with duplicated sales orders ( as I recently faced ).

    But what you should do if you wish create new Sales order is the following code snippet:

    var newSOrder = new SOOrder();

    newSOrder.OrderType = sorder.AcumaticaOrderType; … more

  • How to check Automation step settings in Acumatica

    Hello everybody,

    today I want to describe some tricky feature of Automation steps. 

    Quite often in Acumatica I face interesting challenge. I've added some code in Row_Selected, open some screen, and to mine disappointment I find that screen totally ignores mine code. What can stand behind such weird behaviour?

    One of the explanations can lie behind automation steps. If to put simply, automation steps is a feature of Acumatica, that allows to program it without any usage of C# code. All that is needed from you as Acumatica user is just add via GUI designer staff on the form and then via automation steps configure it's behaviour. 

    So, let's consider some details, that can help you to … more