Contents tagged with Acumatica

  • 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

  • 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

  • How to imitate click on Confirm shipment in Acumatica

    Hello everybody,

    Today I want to describe how to imiate click on menu item "Confirm shipment" in Acumatica. 

    Probably your first guess will be just call method ConfirmShiment of graph SOShipmentEntry. But for now Acumatica team has another advice in order to call this action. Instead of calling method ConfirmShipment you'll need to have a bit more steps.

    Code sample below demonstrates those necessary steps:

    SOShipmentEntry shipmentGraph = PXGraph.CreateInstance<SOShipmentEntry>(); //Create instance of Graph

    PXAutomation.CompleteSimple(shipmentGraph.Document.View);

    PXAdapter adapter2 = new PXAdapter(new DummyView(shipmentGraph, shipmentGraph.Document.View.BqlSelect,

     new  … more

  • Pagination in custom inquiry

    Hello everybody,

    today I want to share with everybody, and with myself code fragment, that allows to achieve pagination in custom inquiry pages. 

    Take a look on the code below:

      public class YourGraphInquiry : PXGraph<YourGraphInquiry>

      {

        public PXCancel<YourDACFilter> Cancel;

            public PXFilter<YourDACFilter> Filter;

            [PXFilterable]

            public PXSelect<YourDACDetails,

                Where2<

                    Where<YourDACDetails.Someid, Equal<Current<YourDACFilter.SomeID>>, 

                        Or<Current<YourDACFilter.SomeID>, IsNull>>,

                    And<

                        Where<YourDACDetails.Somepartid, Equal<Current<YourDACFilter.SomePartId>>, 

         … more

  • Three states of fields in Acumatica

    Hello everybody,

    today I want to write a short note on three states of fields existing in Acumatica:

    Exists but is empty

    Exist and have value

    Has null

    If to speak about string, it can exist like this:

     

    Some value

     

    Do you see difference between 1 and 3? Not easy. As usually developers of C#, show this difference like this:

    ""

    "Some Value"

    null

    And following screenshot with explanation shows how it works in case of SOAP contracts:

    so, while you make integration, keep that in mind more

  • New functions for redirect in Acumatica

    Hello everybody,

    today I want to say few words about new functions for redirect in Acumatica, and particularly about class PXRedirectHelper. 

    Classical approach from T200/T300 manual may look like this:

    var currentCse = Cases.Current;

    if(currentCse == null)

    return;

    var graph = PXGraph.CreateInstance<CRCaseMaint>();

    graph.Case.Current = graph.Case.Search<CRCase.caseCD>(currentCse.CaseCD);

    if (graph.Case.Current != null)

    {

    throw new PXRedirectRequiredException(graph, true, "Case details");

    }

    But with new function all of those lines can be simplified to this:

    PXRedirectHelper.TryRedirect(Cases.Cache, Cases.Current, "Edit case", PXRedirectHelper.WindowMode.NewWindow); … more

  • Simplest cachinng explanation

    Hello everybody,

    today I want to give one more explanation of how to use caching and slots for caching purposes. Also there are plenty of articles on the subject,  I want to give one more with simplest recipe. So, if you need to cache something, you'll need to follow this procedure:

    declare you class as something that inherits IPrefetchable

    Create some placeholder in your class for storing items in the cache

    Implement Prefetch

    Implement GetSlot

    Take a look on the code below, how it can be done:

    public class ArTranFetcher : IPrefetchable

    {

    private List<ARTran> _arTranList = new List<ARTran>();

    public void Prefetch()

    {

    _configurableList = new List<ARTran>(); … more

  • Acumatica Page Missing under Google Chrome Browser

    Hello everybody,This one is a hot topic, recently chrome team released some changes to the Chrome Browser, so that some PAGES could get missing.You still see Menu, still see screen list but the page itself is gone, blank, empty.How to fix?Just change settings in the Chrome:1. Type chrome://flags/ in the browser address bar and press Enter.

    2. You should see the list of options:

    3. In the search bar type Lazy Frame or just Lazy:

    4. Under Enable lazy frame loading choose Disabled:

    5. Press Relaunch Now at the right bottom corner:

    more

  • Four types of programmers

    Hi.It is first time I write on topic of management and recruitment. Question is about one way of classifying your programmers, who work with you now or will come in a future. My main thesis is: all developers, roughly speaking, are divided into 4 large types and each of these types has its own application area.Attempting to send the wrong type to solve inappropriate tasks leads to a failure ( inefficient work, or the employee leaves the team ). If you want to know why, you are welcome. Get ready, we have a lot of information. Basicallly what I say is my perception of world of programmers.

    It is important to understand that there are no "bad" types. If any of the types you think is bad, … more

  • How to modify activities behavior on Business Accounts page

    Hello everybody,

    today I want to write a few words on how to modify behavior of buttons Add task, Add event, Add email, Add activity, ..., Add work item of Business Accounts page, one of which is shown on screenshot below:

    The main issue of chaning it is in the fact, that it is not just ordinary buttons, but separate class, which has injection of logic. Part of it's declaration goes below:

    public class CRActivityList<TPrimaryView> : CRActivityListBase<TPrimaryView, CRPMTimeActivity>

      where TPrimaryView : class, IBqlTable, new()

    {

      public CRActivityList(PXGraph graph)

        : base(graph)

      {

      }

      public CRActivityList(PXGraph graph, Delegate handler)

        : base(graph,  … more

  • How to deal with PX.Data.PXException: Cannot access the uploaded file. Failed to get the latest revision of the file error message

    Hello everybody,

    today I want describe how to deal with following Acumaitca error message: 

    Publish Customization

    Compiled projects: GAPRojectsBusinessAccounts,PayrollV2Acu2018Build20190328,EBizCharge2018R2,GACustomization

    Validation started.

    PX.Data.PXException: Cannot access the uploaded file. Failed to get the latest revision of the file a4353331-8f7f-4b3b-a881-2cdb4d5451e3

    at Customization.CstBinFile.GetFileFromDb() in C:\Bld\AC-FULL2018R226-JOB1\Sources\NetTools\PX.Web.Customization\CstDocumentDOM\CstBinFile.cs:line 120

    at Customization.CstBinFile.SaveFiles(FilesCollection context) in C:\Bld\AC-FULL2018R226-JOB1\Sources\NetTools\PX.Web.Customization\CstDocumentDOM\ … more

  • DashboardPageTitleModule does not implement interface member PX.Web.UI.ITitleModule.GetDefaultVisibility in Acumatica

    Hello everybody,

    today I want to describe how to live with following error message:

    Compilation Error

    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: CS0535: 'DashboardPageTitleModule' does not implement interface member 'PX.Web.UI.ITitleModule.GetDefaultVisibility()'Source Error:

    Line 2: using PX.Web.UI;

    Line 3:

    Line 4: public class DashboardPageTitleModule : ITitleModule

    Line 5: {

    Line 6: public void Initialize(ITitleModuleController controller)

    Source File: c:\Program Files\ … more

  • Merge few customizations into one

    Hello everybody,

    today I want to leave a short notice on how to join few customizations into one. Basically all you need is publish customizations you want to have merged, and then on Customization Projects form ( SM204500 ) click on button View Published and then click on Download package. In that way you'll get Customization.zip which will be merged result of published customizations. more

  • How to modify PXIntList dynamically in Acumatica

    Hello everybody,

    today I want to leave a short code sample on how to modify PXIntList or dropdown list in Acumatica. Below goes code sample of it:

    protected virtual void _(Events.RowSelected<CROpportunity> e)

    {

        if (e.Row == null)

            return;

        var opportunityExtension = e.Row.GetExtension<CROpportunityExt>();

        if (opportunityExtension.UsrProduct == 0)

        {

            var listInts = new List<int>();

            var listStrings = new List<String>();

            listInts.Add(0);

            listInts.Add(1);

            listInts.Add(2);

            listStrings.Add("String 1");

            listStrings.Add("String 2");

            listStrings.Add("String 3");

             … more

  • Creating the new Company, set settings for it from snapshot

    Hello everybody,today I want share with you, how you can create new Company and set it settings.

    For creating new company, we should go to "Tenants" screen:

    Notice, that in old vercions of acumatica instead the "Tenants" was the "Companies":

    Let create new company, and give it name "Exotic Places":

    When process of creation is finished, we'll automatically be logged out:

     

    To fix this, let's copy the settings from existing company to our. First of all let us sign out from "Exotic Places" and sign in to "Company". Then open "Tenants", chose the "Company" and click to "Create Snapshot" button:

    We get a warning message, but it possible easily deal with it, only go … more