Hi All,
I am using On-Prem Business Central.
I have created the below code unit to get the sales price, and i have created web service of this code unit also.
now i am trying to call it from POST MAN with post type post, but i am getting error.
Does anyone have any idea about this. Please let me know.
codeunit 50102 "GetItemPrice"
{
Permissions = tabledata "Price List Line" = rimd;
[ServiceEnabled]
procedure GetPrice(ItemNo: Text[50]; CustomerNo: Text[50]): Decimal
var
PriceListLine: Record "Price List Line";
begin
// Set a filter on "Item No." using the provided ItemCode (AssetNo in your case)
PriceListLine.SetRange("Asset No.", ItemNo);
PriceListLine.SetRange("Source No.", CustomerNo);
// Check if there is a matching Price List Line and return the Price List Code
if PriceListLine.FindFirst() then
exit(PriceListLine."Unit Price")
else
exit(0); // Return empty if no matching record is found
end;
}
Error : 400
{
"error": {
"code": "BadRequest",
"message": "Exception of type 'Microsoft.Dynamics.Nav.Service.OData.NavODataBadRequestException' was thrown. CorrelationId: 6a4a5157-5d90-4ab4-8ebd-fa4713f63e1f."
}
}
Payload :
{
"ItemNo": "111",
"CustomerNo": "122"
}
Header included all the If Match, Content Type and company id also. but same error.
Thanks for your Help.