Contents tagged with Acumatica

  • Current2 vs Current in Acumatica

    Hello everybody,

    today I want to share note about Current2 and Current in Acumatica.

    Current2 inserts really current value of record, while Current inserts curretly selected value or default. I was surprised, that Current2 inserts exactly the value of record. more

  • Types of redirects in Acumatica

    Hello everybody,

    today I want to note about redirects. In Acumatica you can redirect user to another webpage. Acumatica provides option of redirecting to following scenarios:

    To another page in Acumatica

    To another report

    To any destination url

    Try to gues, how redirections are implemented? As exception. If you consider it as wrong approach, I can partially agree with you. But only partially, because redirecting to antoher page is really some kind of exceptional situation. 

    Below goes code of redirecting to page PM302000 at some TaskID and some projectid selected, which will be opened in new window:

    UsrPMTaskReplace taskRepl = JiraAccountTasks.Current;

    ProjectTaskEntry graph = … more

  • DependOnGrid in Acumatica or how to get currently selected record in grid

    Hello everybody,

    today I want to share one important note, for search of which I've spent for two hours. 

    In grid I've added button in the following way:

    <ActionBar ActionsText="True">

    <CustomItems>

    <px:PXToolBarButton>

    <AutoCallBack Command="RemovePMTask" Target="ds" >

    </AutoCallBack>

    </px:PXToolBarButton>

    </CustomItems>

    </ActionBar>

    Initially described it in the following way:

    <px:PXDSCallbackCommand Name="RemovePMTask" Visible="False"

    </px:PXDSCallbackCommand>

    Then added code for button in graph, and noticed terrible behaviour. In my action I wasn't able to get currently selected record in grid. After wondering for two … more

  • How to get top 1 record from db in Acumatica

    Hello everybody,

    today I want to share with you one trick that sometime can be useful. Imagine, that you constructed some BQL query and want to get only one record from db with ommiting others or in other words if you need TOP 1. For this purpose you can use SelectSingle method that generates SQL statement with TOP 1 records to return and executes faster. more

  • How to get tstamp in Acumatica

    Hello everybody,

    today I want to shre small note of how to generate timestamp for Acumatica objects ( in case if you use for some reason PXDataBase.Insert or  PXDataBase.Update)

    PXDataBase has public method SelectTimeStamp.

    public static byte[] SelectTimeStamp()

    {

    return Provider.SelectTimeStamp();

    }

    So, in case if you need to put in variable t TimeStamp you can do the following:

    var t = PXDatabase.SelectTimeStamp();

    And variable t will have timestamp more

  • PXAccumulatorAttribute in Acumatica

    Few notes about PXAccumulatorAttribute

    If to inherit from PXAccumulatorAttribute, you'll have access to member _SingleRecord. If to set in constructor to true, you'll configure single record update mode.

    There is PrepareInsert method. This method intended for updating policy for the data fields.

    PrepareInsert is invoked within Persist method, before Acumatica framework generates SQL commands for inserted data records.

    Among paramethers of PrepareInsert method there is PXAccumulatorCollection, which has method Update. In this method it's possible to configure fields which will be updated during PrepareInsert

    Method Update has following policies: PXDataFieldAssign.AssignBehavior. … more

  • How to disable callback from Checkboxes in Acumatica.

    Hello everybody.

    Today I want to share some details about inner kitchen of Checkboxes in grid of Acumatica.

    If to look inside of generated grid of Acumatica with FireFox Dom and style inspector, you can see following structure:

    Item with checkbox is implemented as td, which has div, and has another div. The first level div has data for internal ( Acumatica presentation ),

    and second div, or internal div has data for user display.

    Once I had task to disable callback from checkbox. You may wonder why somebody can have such task. The reason each tick at checkbox made 

    roundtrip to server, called number of delegates, which significantly slowed down perfomance. By the way,  CommitChanges=" … more

  • How to enable disable menu item in Acumatica

    Hello everybody,

    Today I want to share short glimps how to Enable/Disable menu item. Let's some menu. For example it looks like this:

    Suppose, we added menu action Activate in the following way:

    public PXAction<EPEmployee> Activate;

    [PXButton]

    [PXUIField(DisplayName = "Activate")]

    protected virtual IEnumerable activate(PXAdapter adapter)

    {

    }

    // menu action was added like this:

    public override void Initialize()

    {

    Actions.AddMenuAction(Activate);

    }

    Let's say we want to disable menu item Activate. It can be achieved with usage of RowSelected event and SetEnabled function.  In my case I used the following construction:

    protected virtual void EPEmployee_ … more

  • Make PXDefault as not required for input

    Hello everybody,

    Imagine following situation, you added to your DAC field some default value. For example like this:

    [PXDBDate]

    [PXDefault(typeof(AccessInfo.businessDate))]

    public virtual DateTime? FromDate

    And now you have default value as current date. But what, if you don't like to make it required for input. How to achieve this goal? The answer is quite simple, you just need to add PersistingCheck = PXPersistingCheck.Nothing into pxdefault attribute. Like this:

    [PXDBDate]

    [PXDefault(typeof(AccessInfo.businessDate), PersistingCheck = PXPersistingCheck.Nothing)]

    public virtual DateTime? FromDate

    With such changes you can init your values at form, and make it not required … more

  • Select all rows in Acumatica

    Hello everybody,

    today I want to share one simple trick. Sometime in grid you have chekcboxes, and you can have a need to make all of them selected. Here is sample of code which helps with this task:

    <px:PXGridColumn AllowCheckAll="True" AllowNull="False" DataField="Selected" TextAlign="Center" Type="CheckBox" Width="30px" /> more

  • PXFilteredProcessing in Acumatica

    Hello everybody,

    few day ago I was digging in code of CT502000, and found interesting part of code:

    public PXFilteredProcessing<ContractsList, ExpiringContractFilter> Items;

    As usually in my code I use PXFilter, and discovery of PXFilteredProcessing was confusting for me. 

    The first think that I as usually do, if I see something new, it is watching with reflector in declaration of new type. Here it what reflector shows:

    public class PXFilteredProcessing<Table, FilterTable> : PXProcessing<Table> where Table: class, IBqlTable, new() where FilterTable: class, IBqlTable, new()

    This means, that we can pass into PXFilteredProcessing two tables. T200 manual gives an answer why: Provides … more

  • Save DAC class in acumatica to DB

    Hello everybody,

    today I want to note interesting gotcha. Let's say you want to save object to db in Acumatica. You in your code created some DAC item and want to save it to db. And you call Actions.PressSave() method. And you get error. You can get suspection, that maybe you put some wrong data in your DAC class or something like this. 

    But the real reason is different, According to T200 Acumatica manual: " You should not invoke the Persist()method on the current graph instance. You can do it only for a graph instance created in a background operation."  It means that you should create instance of Graph, and in that instance call method Persist. 

    Here is fragment, which I extracted with … more

  • PXSmartPanel in Acumatica

    Hello everybody,

    today I want to write few words how to work with PXSmartPanel.

    One of my clients asked following:

    1. Press at button.

    2. Pop up should appear with two buttons ( "OK" , "Cancel")

    3. At pop up should be also selector of contracts and datetime.

    4. Existing screen should be modified.

    In order to do this, following actions were implemented:

    1. Existing screen was CT301000.

    2. If to look in screen source code, following line says about graph:

    <px:PXDataSource ID="ds" runat="server" Visible="True" Width="100%" TypeName="PX.Objects.CT.ContractMaint"

    PrimaryView="Contracts" BorderStyle="NotSet">

    3. It means, that we need to create extension class for  … more

  • Event handlers in Acumatica

    Hello everybody,

    today I want to share with you how order of event handlers in Acumatica is organized.

    Each graph has list of event handlers for each type of manipultaion. Also new declarations of methods can be added to the start or then end of collection, and there are events which are added in the beginning of collection.

    According to T300 event handlers which are added to the end of collection:

        • FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)

        • RowSelecting(PXCache sender, PXRowSelectingEventArgs e)

        • RowSelected(PXCache sender, PXRowSelectedEventArgs e)

        • RowInserted(PXCache sender, PXRowInsertedEventArgs e)

        • RowUpdated(PXCache sender, … more

  • Usage of base views in Acumatica

    Hello everybody.

    Today I want to write interesting detail, which was strange for me. 

    Imagine situation, that you in Extention class want to change some behaviour and want to ask something from view in base graph. You can try to do it with Base.BaseViewName.Cache.Current. And according to my observations it works. But as mentioned in T300 manual To query a data view declared within the base BLC or lower-level extension from the data view delegate, you should redeclare the data view within the BLC extension.

    If you want to ask why this copy/paste needed I honestly will tell you: I don't know :) more

  • Extentsion table in Acumatica with IsOptional

    Hello everybody,

    today I want to notice few words about attribute IsOptional. DAC extension can be mapped by inner join, or by left join statement. 

    [PXTable(IsOptional = value)] // default is false, or Inner join

    public class DACTableExtension : PXCacheExtension<BaseDACTable>

    {

    ...

    }

    As far as I understand idea behind name, IsOptional means are there additional items from left join. And if set to true, means yes, there are, and if set to false ( default way ) there are not.

    The left join way ( IsOptional = true ) can be used for

    not synched tables

    creates extension record when record in base table created or updated

    calculates default field values if no extension table … more

  • DeletedDatabaseRecord in Acumatica

    Hello everybody,

    today I want to share notice about DeletedDatabaseRecord database field. Sometime in db you can notice DeletedDatabaseRecord field. For example there is DAC Sub. You can even wonder what is this if it is not visible for users? It is purposed Acumatica for monitoring is record deleted, and presented. 

    Another area of usage DeletedDatabaseRecord is extension tables. If you want to use extension table, and basic table has DeletedDatabaseRecord, then you should add it to extension table as well. more

  • What is companyid in Acumatica

    Hello everybody,

    today I want to notice few words about companyid field. What is it's purpose. Initially Acumatica provides two !!!! companyid. 1 and 2. Why two? The first is for some Acumatica internal usage, and then your company will get id 2. Even if you believe that your company deserve to be 1, you'll get 2 or more. It means that first active company will have id 2 or bigger. So, if you have some DAC which should be used by few companies, then you just add companyid field, make it as key, and that's it, Acumatica will track to which company your entity should belong. more

  • Grid toolbar buttons in Acumatica

    Hello everybody,

    have you ever wondered, that SkinID property may regulate grid toolbar set of buttons? For me it was unknown untill today. Here it is list of id's and buttons according to T200:

    Primary: Adds the Add, Delete, Fit to Screen, and Exportbuttons to the toolbar. This value is typically used for a grid on a simple edit page that consists of the single grid.

    Details or DetailsInTab: Adds the Refresh, Add, Delete, Fit to Screen, and Export buttons to the toolbar. This value is typically used for a grid that displays the detail data on a master-detail page

    Inquire: Adds the Refresh, Fit to Screen, and Export buttons to the toolbar. This value is typically used for grids on … more

  • Merged and read-only modes in Acumatica

    Hello everybody,

    today another notice. Acumatica can provide values in two modes: merged and read-only.

    So, what is merged? Imagine that user worked about the form, and made some changes at grid. Will changes apper in DB? Untill will be executed Persist, not. Data will be only in cache. Some time it is useful to compare data in cache with data in db. In order to get merged data you can use PXSelectReadOnly type or PXSelectGroupBy. For merged results you can use PXSelect or PXSelectJoin. more