I'm trying to GET/POST a customer payment by exposing a web service in business central.
With the already available REST API endpoint (https://docs.microsoft.com/en-us/dynamics-nav/api-reference/v1.0/api/dynamics_create_customerpayment) for creating customer Payments, it requires customerPaymentJournalId like below and works as expected.
POST businesscentralPrefix/companies({id})/customerPaymentJournals({id})/customerPayment
But I want to achieve the same with web services, to be precise.
The service I exposed is "customerPayments" and the URL looks like below:
GET https://api.businesscentral.dynamics.com/v2.0/{tenantId}/Sandbox/ODataV4/Company('{companyId}')/customerPayments
which throws the below error:
{
"error": {
"code": "Application_DialogException",
"message": "You must specify a journal batch ID or a journal ID to get a journal line. CorrelationId: xxxxx-xxxx-xxxx-xxxx-xxxx."
}
Hello,
We currently do not have dedicated Dev support via the Dynamics 365 Business Central forums, but I wanted to provide you some additional resources to assist. If you need assistance with debugging or coding I would recommend discussing this on one of our communities.
dynamicsuser.net/.../developers
I will open this up to the community in case they have something to add.
Thanks.
I tried the above
POST https://api.businesscentral.dynamics.com/v2.0/{tenantId}/Sandbox/ODataV4/Company('{compnayId}')/customerPayments
Body:
Resulting in error:
You need a payload which uses the primary key of the underlying table. In this case it’s the general journal line table. Something like this would do the trick:
{
"Journal_Template_Name": "GENERAL",
"Journal_Batch_Name": "DEFAULT",
"Posting_Date": "2019-07-31",
"Document_Type": "Payment”,
"External_Document_No": "",
"Account_Type": "Customer",
"Account_No": "110-49",
"Amount": 2000,
"Bal_Account_Type": "Bank Account”,
"Bal_Account_No": "962-05",
"Comment": "Web serivce posting",
"Shortcut_Dimension_1_Code": "PROPERTY",
"Shortcut_Dimension_2_Code": "21-01-001",
"ShortcutDimCode3": "80-50-025",
"ShortcutDimCode4": "",
"ShortcutDimCode5": "",
"ShortcutDimCode6": "",
"ShortcutDimCode7": "",
"ShortcutDimCode8": ""
}
Sohail Ahmed
1,200
YUN ZHU
1,006
Super User 2025 Season 1
Mansi Soni
864