Contents tagged with Acumatica

  • 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

  • PXPrpojection, Data Projection what is it?

    Hello everybody.

    Imagine that you need to have implementation of several tables with possibility to update them all. 

    Also you want to implement by the Acumatica side rather than by the database.

    You know that Joined tables in Acumatica are read-only and you cannot update fields there

    Can we create/use SQL-like views in Acumatica?

    How can I join grouped (statistical) view to the DAC?

    So, yes we can do it. For this purpose Acumatica gives you PXprojection attribute.

    PXProjection attribute  binds the DAC to an arbitrary data set. The attribute thus defines a named view, but is implemented by the server side rather than by the database.

    Lets start)

    Steps:

    Think whats tables you … more

  • Inventory items images structure in Acumatica

    Hello everybody,

    today I want to document some information about how images for inventory items are stored in Acumatica. 

    Database structure (Acumatica)

    InventoryItem - A table that contains all InventoryItem data

    > ImageURL - A data field where the image file name being saved.

     

    UploadFile - A table that contains attachments data

    > Name - A data field where you can use to join with InventoryItem using InventoryItem.ImageURL = UploadFile.Name

     

    NoteDoc - A table that contains all NoteDoc data

    > FileID - A data field unique ID where you can use to join with UploadFile using UploadFile.FileID = NoteDoc.FileID

     

    A SQL query that get data necessary to create the imageExternalLink … more

  • How to set command time out part 2

    Hello everybody,

    today I want to document few ways on how to modify command time out. Sometime it may happen that you have some kind of long runnig queries, and at some particular graph you may want to make it live longer. 

    For such purposes very convenient is PXCommandScope object. Below goes code sample that allow you to achieve this purpose:

     using (new PXCommandScope(PXDatabase.Provider.DefaultQueryTimeout * 2))  // increasing 2 fold {               var results = PXSelect<BAccount>.Select(this); }

    with such code you can get twice a time for your BQL statements.  more

  • How to modify Query timeout in Acumatica

    Hello everybody,

    today I want to share with you some trick which I used for cases if I get error message that some select from Acumatica timed out. Sometime if you work with big tables ( ~2 millions of records ) you may face timeout errors. Especially it is troublesome for processing screens when you are ready to wait for some kind of functionality just in order to be complete. Let me introduce you to property DefaultQueryTimeout of PXDataBase.Provider static class. By default it's value is set to 90, which means that it will be executed by sql server for 90 seconds. I should admit that for majority of cases it is more then enough. Except for cases when you need to fix some bugs in code. … more

  • Create customization to MYOBAdvanced(Acumatica), part 2 сreate page, graph, DAC class extension and xml page for mobile

    So, continue the work:). Part 1 is here.

    Part 2 сreate page, graph, DAC class extension and xml page for mobile

    First of all, In project I create folder "DAC" and add two clasess:

    ActivityTypes.cs

    This class need to filter types rows from table CRActivity(column name - Type). Client asked display all events for that Business Account of type "Phone Call", "Client Visit" and "Futile Visit" So for this I do next:

    public static class ActivityTypes

       {

           public const string F = "F";

           public const string M = "MEET";

           public const string P = "P";

           public class fType : Constant<String>

           {

               public fType()

                   : base(F)

               … more

  • Create customization to MYOBAdvanced(Acumatica), part 1 description of the task, prepare to start

    I want to tell you some little history about how was created customization to existing MYOBAdvanced (Acumatica) project.

    One guy who buy and use acumatica from MYOBAdvanced (myob.com), asked me to create customization.

    He wrote:

    "

    The standard platform under Business Accounts has the Activities tab, which is where we record the data. Refer to attached screenshot.

    I need a search page as follow on the app/mobile device:

    Search field which only searches the Business Account Name field. 

    The user enters text, then Business account names that match that text are displayed, the user then selects the required account.

    The page then display all events for that Business Account of type " … more

  • How to separate Automation schedules in Acumatica

    Hello everybody,

    take a loot at the following picture:

    Let's say that you would like to have two Acumatica instances connected to the same database. Is it possible? Definetely yes, just with pointing both of them to the same connection string and you'll get some kind of scalability. 

    But imagine that your Acumatica has execution of some automation schedules. How to make sure, that only one of them will be executor of Automation schedules, not both of them?

    Very simple. Just add this key to web.config of Acumatica which should not be Automation schedules executor:

     <add key="DisableScheduleProcessor" value="True"/>

    Default value of DisableScheduleProcessor key is false, so you need … more

  • How to modify Stock Item screen ( IN202500 ) in Acumatica with adding master detail selectors

    Hello everybody,

    today I want to describe how to extend Stock Item screen IN202500 in Acumatica. Imagine that you need to add to tab General settings two selectors. Suppose that you need to have two selectors:

    as you can see following need to be achieved:

    To tab General Settings it is needed to add selectors: "Clase articulo web" and "Subclase articulo web".

    In case if selector "Clase articulo web" changes, then "Subclase articulo web" should show some other values.

    The first step should be start Acumatica developer project as described here.

    For cases if we have dependency of one selector from another it is possible to program in two ways:

    Custom selector for dependent code. … more

  • Operator IN in BQL

    Hello everybody,

    today I want to write a few words about operator in which was presented in SQL for long ago, but weren't available in Acumatica BQL. But time goes on and now you can use it. For example like this:

    Object[] values = new String[] { "BXW000004", "BXW000005" };

                    POOrder item = PXSelect<POOrder,

                        Where<POOrder.orderNbr, In<Required<POOrder.orderNbr>>>>.Select(Base, values);

    that code will generate following sql statement:

    Select * from POOrder POOrder Where POOrder.OrderNbr In ('BXW000005', 'BXW000004')

    Order by POOrder.OrderNbr

    I can say that such approach simplifies some tasks that require dynamic passing of arguments.

    more

  • Scaling Acumatica horizontally

    Hello everybody,

    today I want to share one interesting piece of information about horizontal scaling of Acumatica. I mean as usually for majority of people it is clear that Acumatica can work on one machine when DB, IIS and Acumatica lives on one machine. 

    One more variant of scaling can be when you have IIS with Acumatica on one machine, and DB on another machine. It can look like this:

    Here User lives on his machine, Acumatica ERP server lives on second machine, and site database lives on third machine. That is pretty good working schema especially for cases if you need vertical scalability.

    But recently I've discovered little bit more horizontal scalability for Acumatica which … more

  • Automation schedule screen is not executed

    Hello everybody,

    today I want to describe interesting feature of Acumatica related to back ups of database. Imagine the following: you've restored database from back up at your dev environment. And let's say you have automation schedule that every hour you should send to each contact some emails. So, you've restored customization and would like to find the button that will block sending of all emails. At which screen it is? At none. It is interesting to know, that Acumatica already "pressed" at this button when you've restored db from back up. But for now you probably have another question. How to debug execute any schedule at all?

    I propose following steps:

    Delete all automation … more

  • How to modify default time zone at Acumatica

    Hello everybody,

    today I want to make a short notice on how to change default time zone in Acumatica. 

    In my case such need appeard when it was needed to modify default time zone of Acumatica that I've restored from database backup. In order to do this you'll need to go to screen that is named Site preferences. Id of that screen is sm200505.  more