ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

purchaseInvoiceLines endpoint does not accept Resource Item type custom unit cost

Open Iamabdul opened this issue 5 years ago • 5 comments

When posting to the api/v2.0/companies({{companyId}})/purchaseInvoiceLines endpoint using this body:

{
    "documentId": "{docId}",
    "lineType": "Resource",
    "lineObjectNumber": "LINDA",
    "description": "bbb",
    "unitCost": 20,
    "quantity": 2
}

The unit cost of the post body is ignored and instead uses the default resource item unit cost, it returns with this body in the result.

{ ... "id": {newId}, "documentId": "{docId}, "itemId": "00000000-0000-0000-0000-000000000000", "accountId": "00000000-0000-0000-0000-000000000000", "lineType": "Resource", "lineObjectNumber": "LINDA", "description": "bbb", "unitOfMeasureCode": "HOUR", "unitCost": 50, "quantity": 2, "taxCode": "REDUCED", "taxPercent": 5, "netAmount": 100, "netTaxAmount": 5, "netAmountIncludingTax": 105, ... }

Iamabdul avatar Sep 09 '21 14:09 Iamabdul

Hi @Iamabdul . I suggest you yo change the order in statement, put "quantity" before "unitcost" that should solve the problem. Let me know about the result.

RomanZanizdra avatar Sep 13 '21 12:09 RomanZanizdra

@Iamabdul , I also see you use purchaseInvoiceLines for exposure that doesn't look like existing in BC page. So also please try your request on the purchaseDocumentLines and share the result.

RomanZanizdra avatar Sep 14 '21 06:09 RomanZanizdra

Hi @Iamabdul . Any update from your side?

RomanZanizdra avatar Sep 17 '21 09:09 RomanZanizdra

@RomanZanizdra Apologies for the late reply!

I've attempted to put "quantity" before "unitcost" and that didn't work unfortunately.

I'm also using this page, I'm assuming that this is what this endpoint hits?: api.businesscentral.dynamics.com/v2.0/sandbox/api/v2.0/companies({{companyId}})/purchaseInvoiceLines

Iamabdul avatar Sep 20 '21 17:09 Iamabdul

Hi,

This is an issue with not only API but also web client. Changing quantity resets direct unit cost. We have logged an internal work item to track the issue.

As a workaround you can make one more PATCH call to unitCost after the POST request:

PATCH api/v2.0/companies({{companyId}})/purchaseInvoiceLines({{purchaseInvoiceLineId}}) { "unitCost": 50 }

onbuyuka avatar Oct 07 '21 15:10 onbuyuka