Question

Adding records deletes old one


Userlevel 2
Badge

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. 

 


16 replies

Userlevel 7
Badge +5

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. 

Userlevel 2
Badge

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
 

 

Userlevel 7
Badge +5

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

Userlevel 2
Badge

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

 

 

Userlevel 7
Badge +5

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.

Userlevel 2
Badge

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?

 

Userlevel 7
Badge +5

@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. 

Userlevel 2
Badge

Yeah That’s what I did. 

 

Userlevel 2
Badge

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.

Userlevel 7
Badge +5

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

Userlevel 2
Badge

Just a simple screen. 

Userlevel 7
Badge +5

@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 ?

 

Userlevel 2
Badge

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

Userlevel 2
Badge

 

Userlevel 7
Badge +5

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

Userlevel 2
Badge

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.

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