Skip to main content
Question

Adding records deletes old one


Forum|alt.badge.img

Hello everyone. I am currently working on customizing an API to add customer data one by one into a new screen. I have created the necessary table in the database and the screen to display the data. Everything seems to be functioning correctly. However, I have encountered an issue where adding a new record results using PUT API  in the deletion of the old record from both the database and the screen. What steps should I take to address this issue? I have attached a screenshot below for reference.

This is screen. 

 

18 replies

Dmitrii Naumov
Acumatica Moderator
Forum|alt.badge.img+6
  • Acumatica Moderator
  • 595 replies
  • April 29, 2024

I’d assume you have some issues with how the key fields are defined for the record and it just overwrites the old record. But it’s impossible to say without the actual code. 


Forum|alt.badge.img
  • Author
  • Varsity I
  • 114 replies
  • April 29, 2024

I am using Post man right now. I did not code yet. Just trying to make sure everything works fine Then I will start doing code. I will use python
 

 


Dmitrii Naumov
Acumatica Moderator
Forum|alt.badge.img+6
  • Acumatica Moderator
  • 595 replies
  • April 29, 2024

@tahayabali I mean the code for the custom screen/DAC for the new screen. 


Forum|alt.badge.img
  • Author
  • Varsity I
  • 114 replies
  • April 29, 2024

@Dmitrii Naumov I have created screen using Customization project and then using add new code I have added new dac in it. 

 

 


Dmitrii Naumov
Acumatica Moderator
Forum|alt.badge.img+6
  • Acumatica Moderator
  • 595 replies
  • April 29, 2024

So in this DAC I do not see any fields marked as ‘IsKey’. Without that, there can only be one record at a time in this table. So, you should fix the DAC.


Forum|alt.badge.img
  • Author
  • Varsity I
  • 114 replies
  • April 29, 2024

yeah But the problem is still same. even after adding IsKey=true and publishing project. Do i need to add iskey in all fields that i am selecting using API?

 


Dmitrii Naumov
Acumatica Moderator
Forum|alt.badge.img+6
  • Acumatica Moderator
  • 595 replies
  • April 29, 2024

@tahayabali You need to define which fields are the Primary key of the record and set it to these fields. It should also be done for the DB table itself. 


Forum|alt.badge.img
  • Author
  • Varsity I
  • 114 replies
  • April 29, 2024

Yeah That’s what I did. 

 


Forum|alt.badge.img
  • Author
  • Varsity I
  • 114 replies
  • May 1, 2024

Any on please guide me I am still stuck. The problem is in all screens that i have created. Even database deletes the old one andadding new only.


Dmitrii Naumov
Acumatica Moderator
Forum|alt.badge.img+6

@tahayabali please attach the customization package. It’s hard to say without looking at the actual screen/DAC structure


Forum|alt.badge.img
  • Author
  • Varsity I
  • 114 replies
  • May 1, 2024

Just a simple screen. 


Dmitrii Naumov
Acumatica Moderator
Forum|alt.badge.img+6

@tahayabali  the package does not contain the SQL table definition. It would be nice to see that as well.

But overall, I do not understand what you are trying to achieve here.

Do you want a screen that displays a list of records and you send PUT requests to insert a record for different agdc_packing_id ?

 


Forum|alt.badge.img
  • Author
  • Varsity I
  • 114 replies
  • May 1, 2024

Yes. I am trying to insert data for different agdc_packing_id using PUT request


Forum|alt.badge.img
  • Author
  • Varsity I
  • 114 replies
  • May 1, 2024

 


Dmitrii Naumov
Acumatica Moderator
Forum|alt.badge.img+6

There is no PK in this DB table definition. 

You must have a PK defined and it also must have CompanyID column as a part of the primary key. 

Please check the following documentation:

https://help.acumatica.com/(W(11))/Help?ScreenId=ShowWiki&pageid=5659adfe-3e4a-45a6-a94a-a33c2f955194


Forum|alt.badge.img
  • Author
  • Varsity I
  • 114 replies
  • May 1, 2024

I have already tried with that. Again I have added PK in company id and packing_id but still When i put data using API is changes the record I dont know what’s happening.


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • 2640 replies
  • June 5, 2024

Hi @tahayabali were you able to find a solution? Thank you!


Forum|alt.badge.img
  • Author
  • Varsity I
  • 114 replies
  • June 5, 2024

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings