Skip to main content
Solved

Delete Budget Line via REST Deletes matching Accounts ignoring Subaccount

  • Mar 23, 2022 4:14 AM UTC
  • 4 replies
  • 200 views
  • Translate All

BrettBaldwin
Freshman I

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

Best answer by Samuel Olivier Lavigueur

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
}
]
View original

4 replies

Naveen Boga
Captain II
Forum|alt.badge.img+20
  • Captain II
  • Mar 23, 2022 4:55 AM UTC

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

 

 

Translate

Samuel Olivier Lavigueur
Acumatica Moderator
Forum|alt.badge.img+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
}
]
Translate

BrettBaldwin
Freshman I
  • Author
  • Freshman I
  • Mar 23, 2022 10:12 PM UTC

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

Translate

Samuel Olivier Lavigueur
Acumatica Moderator
Forum|alt.badge.img+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.

Translate