Solved

Changes to View Not Saved

  • 30 January 2023
  • 1 reply
  • 58 views

Userlevel 3
Badge +1

I have added a new view to a graph extension, my expectation is that changes made to it would be persisted during the normal Save process. However, I am noticing that after the updates

 

I do not believe my call to TimeActivities.Cache.SetValueExt is actually updating the cache. 

Why would this be?

namespace GPGeneral.CR
{
public class TimeCardMaint_Ext : PXGraphExtension<PX.Objects.EP.TimeCardMaint>
{
public static bool IsActive() => (true);

public PXSelectJoin<EPTimecardTask,
InnerJoin<CREmployee, On<CREmployee.defContactID, Equal<EPTimecardTask.ownerID>>>,
Where<CREmployee.bAccountID, Equal<Current<EPTimeCard.employeeID>>,
And<EPTimecardTask.ownerID, Equal<Current<EPEmployee.defContactID>>,
And<EPTimecardTask.weekID, Equal<Current<EPTimeCard.weekId>>

>
>
>> TimeActivities;

protected void _(Events.FieldUpdated<EPTimecardDetail.timeSpent> e)
{
if (e.NewValue == null)
return;

var nTimeSpent = (int)e.NewValue;
var tmDetail = (EPTimecardDetail)e.Row;
foreach (EPTimecardTask tmTsk in TimeActivities.Select())
{
if(tmTsk.NoteID == tmDetail.RefNoteID)
{
var newClockOut = tmTsk.StartDate.Value.AddMinutes(nTimeSpent);
TimeActivities.Cache.SetValueExt<EPTimecardTask.endDate>(tmTsk, newClockOut);
TimeActivities.Cache.SetValueExt<EPTimecardTask.uistatus>(tmTsk, ActivityStatusListAttribute.Completed);
//tmTsk.EndDate = newClockOut;
//tmTsk.UIStatus = ActivityStatusListAttribute.Completed;
//TimeActivities.Update(tmTsk);
break;
}
}
}
}
}

 

icon

Best answer by Naveen Boga 1 February 2023, 02:17

View original

1 reply

Userlevel 7
Badge +17

@Leif  Code seems to be fine.

Is it executing below IF block ? 

if(tmTsk.NoteID == tmDetail.RefNoteID)

{

//setting the value here??

}

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