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

Community site session details

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

Web Service API Issue with Payment Journal Line Insertion : Internal_EntityWithSameKeyExists

(5) ShareShare
ReportReport
Posted on by 244
Hi Team,
 
I am currently using a Web Service API for the Payment Journal to insert lines from another application.
 
Although the payload does not include any Line No., I am encountering the following error when multiple lines are posted to BC.
 
{"error":{"code":"Internal_EntityWithSameKeyExists","message":"The record in table Gen. Journal Line already exists. Identification fields and values: Journal Template Name='PAYMENTS',Journal Batch Name='xxxx',Line No.='2970000'  CorrelationId:  xxxxx."}}
 
Could you please advise if there is a way to resolve this issue? Kindly note that I am not using batch payloads for inserting lines into the payment journal.
 
Additionally, is there any known limit or bandwidth constraint that on-premises BC accepts for such operations?
 
I appreciate your suggestions and feedback.
 
Thanks & Regards
Raj
I have the same question (0)
  • Ramiz Profile Picture
    597 on at
    Web Service API Issue with Payment Journal Line Insertion : Internal_EntityWithSameKeyExists
    Hi,

    You need to either pass the unique LineNo or calculate it before inserting. If you are using API page you can put the following code on page OnInsert trigger.
     
    trigger OnInsertRecord(BelowxRec: Boolean): Boolean
        var
            GenJournalLine: Record "Gen. Journal Line";
        begin
            GenJournalLine.SetRange("Journal Template Name", Rec."Journal Template Name");
            GenJournalLine.SetRange("Journal Batch Name", Rec."Journal Batch Name");
            if GenJournalLine.FindLast() then
                Rec."Line No." := GenJournalLine."Line No." + 10000
            else
                Rec."Line No." := 10000;
        end;
     
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    19,137 Super User 2025 Season 2 on at
  • Suggested answer
    Jainam M. Kothari Profile Picture
    12,126 Super User 2025 Season 2 on at
    Web Service API Issue with Payment Journal Line Insertion : Internal_EntityWithSameKeyExists

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 4,160

#2
Nimsara Jayathilaka. Profile Picture

Nimsara Jayathilaka. 2,943

#3
Sumit Singh Profile Picture

Sumit Singh 2,823

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans