Contents tagged with Action

  • How to avoid navigation away from created item after calling PressSave or Persist action

    Hello everybody,

    today I want to tell you a story, that swallowed quite big amount of time of whole team.

    Recently we've got seemingly easy to fulfil requirement: 

    Add button to the grid

    Inside of the button fullfil 

    Persist

    Call to db with modifications

    Persist one more time

    Leave the page opened on created item in UI

    Initially our code looked like this:

    public PXAction<SOOrder> SomeAction;

    [PXButton(CommitChanges = true)]

    [PXUIField(DisplayName = "Some Action", Visible = true)]

    protected virtual IEnumerable someAction(PXAdapter adapter)

    {

        Base.Actions.PressSave();

        //API call

        Base.Actions.PressSave();

        return adapter.Get();

    }

    I could say that … more

  • One more description on how to modify behavior of Sales Orders screen in Acumatica

    Hello everybody,

    today I want to present a bit differnt code sample on how to append to behavior of Actions menu items of Sales Orders screen. 

    Quite often there are tasks like add something before ( preprocessing ) or after some menu item action was executed. Once I've described it alredy here, but just want to give another example with usage of Func.

    Take a look on following code sample:

    [PXOverride]

    public IEnumerable Action(PXAdapter adapter, int? actionID, DateTime? shipDate, String siteCD, String operation, 

        String ActionName, 

        Func<PXAdapter, int?, DateTime?, string, string, string, IEnumerable> baseMethod)

    {}

    as you can see, it's very similar to previous post, just … more