Solved

Delete Budget Line via REST Deletes matching Accounts ignoring Subaccount

  • 23 March 2022
  • 4 replies
  • 98 views

I have Budget with line items as follows (simplified):

{
"account": "4100000",
"subaccount": "ADMIN"
"amount": 123.45
},
{
"account": "4100000",
"subaccount": "CAPWRK"
"amount": 567.89
},
{
"account": "5555555",
"subaccount": "ADMIN"
"amount": 1000.00
}

 

If I `PUT` to `/entity/Default/20.200.001/Budget`  but mark `”Delete”: true` on only the first item, both the first two items are deleted - ie: both items with 4100000 as the `account` are deleted, not just the ADMIN subaccount line item.

Am I missing something obvious??

icon

Best answer by Samuel Olivier Lavigueur 23 March 2022, 15:18

View original

4 replies

Userlevel 7
Badge +17

Hi @BrettBaldwin  I’m assuming that this issue is with the KEY fields. 

From the GLBudgetLine DAC, below are KEY fields and you can try with below fields and verify.

  • BranchID
  • LedgerID 
  • GroupID
  • ParentGroupID
  • FinYear

 

 

Userlevel 3
Badge +2

Normally if you want to delete detail line from a record using the API, it is recommended that you first retrieve the record and then use the “id” value along with the delete in order to delete that line

{
“Budget Key Fields”
or
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
},
”Details” : [
{
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"delete": true
}
]

Thanks for the quick replies @SLavigueur and @Naveen Boga - much appreciated!!!

My process is to retrieve the Budget (via “empty” PUT), then update the changes to the detail lines (eg: `amount` / `delete`) as appropriate. I thought that this would leave the `id` fields intact as well as the other key fields setup to allow the back end to match the records to action but am still seeing this weirdness on delete…

Confirming I can “mix” adding / updating / deleting detail lines in the same PUT call???

Userlevel 3
Badge +2

As long as you are specifying the proper “id” value for the update and the delete and no “id” for the adding (since there isn’t one yet), then yes you should be able to do adding / updating / deleting in the same PUT call.

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