Hello,
I am currently trying to open up a smart panel based on values in a grid on the row selected. Unfortunately, the values are not being updated on the filterview (a series of unbound fields I have) when I open it using PXFormula. It works when I open up the first row, but then after that, it doesn’t update with subsequent rows selected.
To remedy this, I try to update my PXFilter view before running .AskExt.. and it works to update the values, but once I do this it won’t save the updated values. See below for code:
public PXAction<ModifyDialog> Modify;
[PXButton(CommitChanges = true, DisplayOnMainToolbar = false)]
[PXUIField(DisplayName = "Modify")]
protected void modify()
{
if (UpdateModifyView() != true ||ModifyDialogView.AskExt(true) != WebDialogResult.OK) return;
else { ModifyActivity(); }
}
private bool UpdateModifyView()
{
EPActivityApprove modTPActivity = TimesheetView.Current;
if(modTPActivity is null) return false;
PMTimeActivityExt modTPActivityExt = modTPActivity.GetExtension<PMTimeActivityExt>();
if(modTPActivityExt is null) return false;
ModifyDialogView.Current.TimeIn = modTPActivity.Date;
ModifyDialogView.Update(ModifyDialogView.Current);
return true;
}
private void ModifyActivity()
{
EPActivityApprove modTPActivity = TimesheetView.Current;
if(modTPActivity is null) return;
PMTimeActivityExt modTPActivityExt = modTPActivity.GetExtension<PMTimeActivityExt>();
if(modTPActivityExt is null) return;
//Get Activity
EmployeeActivitiesEntry graphActivity = PXGraph.CreateInstance<EmployeeActivitiesEntry>();
graphActivity.Clear();
graphActivity.Activity.Insert(modTPActivity);
modTPActivity.Date = ModifyDialogView.Current.TimeIn;
graphActivity.Activity.Update(modTPActivity);
graphActivity.Actions.PressSave();
EmployeeFilterView.Current.Status = "CI";
EmployeeFilterView.Update(EmployeeFilterView.Current);
}
So two ways I’m hoping someone can get me input..
- If I use PXFormula to update the PXFilter values.. how can I ensure it refreshes based on the row selected (see below for my current field declaration).
#region TimeIn
[PXDateAndTime]
[PXFormula(typeof(Current<PMTimeActivityExt.usrBlyTimeIn>))]
[PXUIField(DisplayName = "Time In")]
public virtual DateTime? TimeIn { get; set; }
public abstract class timeIn : PX.Data.BQL.BqlDateTime.Field<timeIn> { }
#endregion
- If not, why is my code not updating the graph when I don’t call the modifycurrentfilter vs when I do.