Skip to main content
Answer

PXLockViolationException 2021 R1

  • June 2, 2021
  • 6 replies
  • 378 views

Hi,


I always got PXData.PXLockViolationException a.k.a “another process has added…..”

We are having a upgrade procedure right now.
in my 2019 R1 Project same code, it works, but when on 2021R1, it returns me this error.
Is there a new way to add lines programmatically in 2021 R1?

I always do.

var item = Details.insert();
item.description = someDescription.

Details.Update(item);

but when I do Actions.PressSave() it triggers the error.

been going here for weeks. I tried all solutions I can think about.

 

Thanks,

 

Ed

Best answer by Dmitrii Naumov

Hi Ed, 

Could you please try to replace Actions.PressSave() with Save.Press()? Or even with just Persist()

6 replies

Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • June 2, 2021

Hi @Edong ,

Can you try like below by having a new object and verify?

 

DACName obj = new DACName();

obj.ID = PrimaryKeyValues;  

Details.Insert(obj);
obj.description = someDescription.

Details.Update(obj);

this.Actions.PressSave();

 

 


  • Author
  • Freshman I
  • June 2, 2021

Hi @Edong ,

Can you try like below by having a new object and verify?

 

DACName obj = new DACName();

obj.ID = PrimaryKeyValues;  

Details.Insert(obj);
obj.description = someDescription.

Details.Update(obj);

this.Actions.PressSave();

 

 

I use PXDBDefault as well as PXParent attributes to auto-populate the lines. or the child table


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • June 2, 2021

This will work with above code also right?

 


  • Author
  • Freshman I
  • June 2, 2021

This will work with above code also right?

 

yeah, it is still the same error.


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • June 2, 2021

To identify the root cause, please comment on all the Cache.Update(DACobjects) source code on the particular Graph file and verify.

Even I also faced the same prob but I identified and fixed the root cause like this. Hope this helps!!


Dmitrii Naumov
Acumatica Moderator
Forum|alt.badge.img+7
  • Acumatica Moderator
  • Answer
  • June 2, 2021

Hi Ed, 

Could you please try to replace Actions.PressSave() with Save.Press()? Or even with just Persist()