Skip to main content
Solved

Delete Budget Line via REST Deletes matching Accounts ignoring Subaccount

  • 23 March 2022
  • 4 replies
  • 107 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??

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

 

 


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” : e
{
"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???


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