Contents tagged with PXAdapter

  • 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