I have customized Acumatica’s Cost Projection Screen (PM305000) as follow
It basically have added a second grid to “Revision Log” as child to “Projection Line” grid to keep the history of changes on projection lines. Also I have customized Acumatica’s standard copy paste function to copy the “Revision Log” to the new projection revisions. The method code is as follow:
protected virtual void CreateNewProjectionWithLog(PMCostProjection original, PMCostProjectionCopyDialogInfo info)
{
PMCostProjection newDoc = new PMCostProjection();
newDoc.ProjectID = original.ProjectID;
newDoc.ClassID = original.ClassID;
newDoc.Description = original.Description;
newDoc.RevisionID = info.RevisionID;
CostProjectionEntry target = PXGraph.CreateInstance<CostProjectionEntry>();
target.Clear();
target.SelectTimeStamp();
newDoc = target.Document.Insert(newDoc);
foreach (PMCostProjectionLine line in Base.Details.Select())
{
PMCostProjectionLine copy = (PMCostProjectionLine)Base.Details.Cache.CreateCopy(line);
copy.RevisionID = newDoc.RevisionID;
copy.NoteID = null;
copy.Mode = ProjectionMode.Manual;
copy = target.Details.Insert(copy);
copy.Mode = line.Mode;
target.Save.Press();
foreach (UDCTPMCostProjectionRevisionLog log in RevisionLogsView.Select())
{
UDCTPMCostProjectionRevisionLog logCopy = (UDCTPMCostProjectionRevisionLog)RevisionLogsView.Cache.CreateCopy(log);
logCopy.RevisionID = copy.RevisionID;
logCopy.LineNbr = copy.LineNbr;
logCopy.NoteID = null;
logCopy = RevisionLogsView.Insert(logCopy);
target.Save.Press();
}
}
target.Save.Press();
PXRedirectHelper.TryRedirect(target, PXRedirectHelper.WindowMode.Same);
}
My copy operation successfully copies Projection Document (Acumatica Table) and Projection Line (Acumatica Table) but fails to “SAVE” the Revision Log (Custom Table) . Can someone shed some light what I’m doing wrong?