Can we change the function of the Save and Close button?
If yes, How can we change it?
Best answer by Hughes Beausejour
View originalCan we change the function of the Save and Close button?
If yes, How can we change it?
Best answer by Hughes Beausejour
View originalCreate 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();
}
}
}
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.