web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Unable to create a customer payment with ODataV4 web service?

(0) ShareShare
ReportReport
Posted on by 25

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."

}
}


 How can I perform both GET & POST operations for this customerPayments page web service?
I have the same question (0)
  • Suggested answer
    JAngle Profile Picture
    133 on at

    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": ""

    }

  • star lord Profile Picture
    25 on at

    I tried the above

    POST https://api.businesscentral.dynamics.com/v2.0/{tenantId}/Sandbox/ODataV4/Company('{compnayId}')/customerPayments

    Body:

    {
      "Journal_Template_Name": "CASHRCPT",
      "Journal_Batch_Name": "GENERAL",
      "Document_Type": "Payment",
      "Account_Type": "Customer",
      "Account_No": "20000",
      "Amount": 2000,
      "Bal_Account_Type": "G/L Account",
      "Bal_Account_No": "10200",
      "Comment": "Web service posting"
    }

    Resulting in error:

    {
       "error": {
           "code": "BadRequest",
           "message": "Does not support untyped value in non-open type.  CorrelationId:  xxxx."
       }
    }

    How can we retrieve (GET) payments then?
    I could achieve to get a payment(s) by using $filter but that is not an option for me currently

    Also, can you tell me where to look for information regarding primary keys of tables?

    Thanks
  • Suggested answer
    Marco Mels Profile Picture
    on at

    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.

    www.yammer.com/dynamicsnavdev

    dynamicsuser.net/.../developers

    I will open this up to the community in case they have something to add.

    Thanks.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,098

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,556 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,108 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans