Saving Entry from Custom Button


It’s a pretty common situation when you need to call the Save action from your button. You could use it in graph extension or directly in the base graph. We will use the extension as the example but the code almost the same for the pure graph.

There are two requirements:

  1. A button should use the IEnumerable version of the method, not void. A method without the return brokes navigation after saving. A user could get blanked screen when saving a new document.
  2. A method should be decorated with PXButton attribute with CommitChanges = true property, otherwise, the Save button could stay in enabled status after saving. Not tested with CommitChanges in aspx, but this way also should work.
public PXAction<SOOrder> saveEntry;
[PXUIField(DisplayName = "Save Entry")]
[PXButton(CommitChanges = true)]
protected virtual IEnumerable SaveEntry(PXAdapter adapter)
    var result = Base.Save.Press(adapter);
    return result;

Leave a Reply

Your email address will not be published. Required fields are marked *