Skip to main content
Question

Adding records deletes old one

  • Apr 29, 2024 3:32 PM UTC
  • 18 replies
  • 221 views
  • Translate All

Forum|alt.badge.img+3

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
Community Manager
Forum|alt.badge.img+7

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. 

Translate

Forum|alt.badge.img+3
  • Author
  • Captain I
  • Apr 29, 2024 3:40 PM UTC

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
 

 

Translate

Dmitrii Naumov
Community Manager
Forum|alt.badge.img+7

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

Translate

Forum|alt.badge.img+3
  • Author
  • Captain I
  • Apr 29, 2024 3:54 PM UTC

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

 

 

Translate

Dmitrii Naumov
Community Manager
Forum|alt.badge.img+7

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.

Translate

Forum|alt.badge.img+3
  • Author
  • Captain I
  • Apr 29, 2024 4:14 PM UTC

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?

 

Translate

Dmitrii Naumov
Community Manager
Forum|alt.badge.img+7

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

Translate

Forum|alt.badge.img+3
  • Author
  • Captain I
  • Apr 29, 2024 4:28 PM UTC

Yeah That’s what I did. 

 

Translate

Forum|alt.badge.img+3
  • Author
  • Captain I
  • May 1, 2024 4:46 PM UTC

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.

Translate

Dmitrii Naumov
Community Manager
Forum|alt.badge.img+7

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

Translate

Forum|alt.badge.img+3
  • Author
  • Captain I
  • May 1, 2024 6:19 PM UTC

Just a simple screen. 

Translate

Dmitrii Naumov
Community Manager
Forum|alt.badge.img+7

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

 

Translate

Forum|alt.badge.img+3
  • Author
  • Captain I
  • May 1, 2024 8:08 PM UTC

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

Translate

Forum|alt.badge.img+3
  • Author
  • Captain I
  • May 1, 2024 8:12 PM UTC

 

Translate

Dmitrii Naumov
Community Manager
Forum|alt.badge.img+7

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

Translate

Forum|alt.badge.img+3
  • Author
  • Captain I
  • May 1, 2024 9:20 PM UTC

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.

Translate

Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • Jun 5, 2024 10:07 PM UTC

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

Translate

Forum|alt.badge.img+3
  • Author
  • Captain I
  • Jun 5, 2024 10:10 PM UTC

@Chris Hackett no

 

Translate