1

I was trying to update OperationCD in AMProdOper with my ProcessStepCD. But it gives me error when I call prodDetailMaint.Save.Press();

Error: Another process has added the 'Note' record. Your changes will be lost.

   at PX.Data.PXCache`1.PersistInserted(Object row, Boolean bypassInterceptor)
   at PX.Data.PXNoteAttribute.RowPersisting(PXCache sender, PXRowPersistingEventArgs e)
   at PX.Data.PXCache.OnRowPersisting(Object item, PXDBOperation operation)
   at PX.Data.PXCache`1.PersistInserted(Object row, Boolean bypassInterceptor)
   at PX.Data.PXCache`1.Persist(PXDBOperation operation)
   at PX.Data.PXGraph.Persist()
   at PX.Objects.AM.ProdDetail.Persist() in D:\Bld5\AC-FULLCOMMON64-JOB1\code_repo\WebSites\Pure\PX.Objects.AM\AM\ProdDetail.cs:line 310
   at PX.Data.PXSave`1.d__2.MoveNext()
   at PX.Data.PXAction`1.d__38.MoveNext()
   at PX.Data.PXAction`1.d__38.MoveNext()
   at PX.Data.PXAction`1.PressImpl(Boolean internalCall, Boolean externalCall)

It was working fine in previous release but start giving error when we move to Acumatica 22r1 release.

Please help me out

Parent Function:-

  ProdDetail prodDetailMaint = PXGraph.CreateInstance<ProdDetail>();
  prodDetailMaint.ProdItemRecords.Current = prodItem;
    <SomeDeleteCodeFromIfnotExist> //however it's not executing
    <CalledChildFunction(prodItem, formula, fg, prodDetailMaint)>;              
prodDetailMaint.Save.Press();

ChildFunction:-

        PXResultset<AMProdOper> prodOperResultSet = prodDetailMaint.ProdOperRecords.Select();

    foreach(EWPMBatchProcessStep batchStep in this.BatchProcessStep.Select()) {
         AMProdOper prodOper = FindAMOper(prodOperResultSet, amProdItem, batchStep.AMProdOperID);

       if(prodOper.OperationCD != batchStep.BatchProcessStepCD) {
         prodOper.OperationCD = batchStep.BatchProcessStepCD;
       }
   prodDetailMaint.ProdOperRecords.Update(prodOper);
subodh
  • 11
  • 2
  • in 22R1 the operationcd is now key (vs ID). See if you are getting a new operation in cache with your code. Might be tricky trying to change the keys of the dac as this is how the cache stores each row (by key) – Brendan Apr 12 '22 at 19:24
  • Thanks Brendan. It's right answer. Although i have found that on next day and also posted that here. Why it's not seeing i am not sure. However, Thanks again for your time and response. – subodh Apr 14 '22 at 07:13
  • @subodh How did you solve this? We are trying to do the same thing and having the same error. – Freeman Helmuth Jan 17 '23 at 22:09
  • Hi Freeman, I have commented my code which is updating OperationCD after inserted. – subodh Jan 24 '23 at 07:24

0 Answers0