Solved

Save and Close button

  • 8 July 2021
  • 1 reply
  • 606 views

Can we change the function of the Save and Close button?

If yes, How can we change it?

icon

Best answer by Hughes Beausejour 8 July 2021, 19:27

View original

1 reply

Userlevel 5
Badge +2

Create a graph extension and re-define the ‘Save & Close’ action in it.

Example that extends Save & Close action for Activity screen:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PX.Data;
using PX.Objects.AR;
using PX.Objects.CR;
using PX.ObjectsExt.CR;
using SP.Objects.SP;
using Tools.DAC;

namespace SP.ObjectsExt.SP
{
    public class SPCommentExt : PXGraphExtension<SPComment>
    {
        public override void Initialize()
        {
            ObjectsExt.CheckReattestRequired.Check(this.Base);
        }

        public PXAction<CRActivity> SaveClose;
        [PXUIField(DisplayName = "Save & Close")]
        [PXButton]
        public virtual IEnumerable saveClose(PXAdapter pxAdapter)
        {
            foreach (var res in Base.SaveClose.Press(pxAdapter))
            {
            }
            if (PXSiteMap.Provider.FindSiteMapNodeByScreenID(Base.Comment.Current.LastModifiedByScreenID)
                    .GraphType.IndexOf("Case") > -1)
            {
                if (Base.Case.Current.Status != CRCaseStatusesAttribute._PENDING_CUSTOMER)
                {
                    CRCaseExtension rowExt = Base.Caches[typeof(CRCase)].GetExtension<CRCaseExtension>(Base.Case.Current);
                    if (rowExt == null) return pxAdapter.Get();
                    if (rowExt.UsrReminderCount.HasValue)
                    {
                        rowExt.UsrReminderCount = null;
                    }
                    if (Base.Caches[typeof(CRCase)].GetStatus(Base.Case.Current) == PXEntryStatus.Notchanged)
                        Base.Caches[typeof(CRCase)].SetStatus(Base.Case.Current, PXEntryStatus.Updated);
                }
                Base.Actions.PressSave();
            }
            return pxAdapter.Get();
        }
    }
}

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved