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

Announcements

News and Announcements icon
Community site session details

Community site session details

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

Sales order integration using job queue from CRM TO BC

(1) ShareShare
ReportReport
Posted on by 6
I have the same question (0)
  • Suggested answer
    Teagen Boll Profile Picture
    3,624 Super User 2026 Season 2 on at

    It looks like you're trying to sync a line for a header record that doesn't exist in BC. The Sales Header in this case looks to not be created or it was previously created but no longer in the Sales Order list. Can you check your Sales Order page and see if that document exists? The Sales Header table uses Document Type and Document No. as a primary key so for any integration you need to make sure that the Sales Header is made first and then lines are created after with a reference to the existing Sales Header.

     

    Best,

     

    Teagen Boll, CPA
  • Suggested answer
    Mansi Soni Profile Picture
    10,390 Super User 2026 Season 2 on at

    Hello @QN-03080613-0 ,

    The error indicates that the Sales Line contains a Document No. that does not have a corresponding Sales Header. In a CRM-to-BC integration running through the Job Queue, this usually means the Sales Header was not created/synchronized successfully before the Sales Lines were processed, or the integration mapping is creating the line with an incorrect Document No. Check the Job Queue and synchronization logs, confirm that the CRM Sales Order is successfully mapped/coupled to a BC Sales Header, and ensure the header is created before its lines. Standard Dynamics 365 Sales integration already uses the CRM Sales Order > BC Sales Header/Sales Line process, so if this is a custom integration, the technical team should debug the sequence and mapping.

    I hope this answer helps. If you find it helpful, please consider marking it as the verified answer.

    Regards,
    Mansi Soni

  • Suggested answer
    Grigorios Mavrogeorgis Profile Picture
    3,110 Super User 2026 Season 2 on at

    Hi, you must check what No. the header actually got in BC. ORD-01014-R9B4R9 looks like the CRM number. If your code does Insert(true) without filling "No." first, BC is using its own number from the No. Series. Then your lines point at something that never existed.  You must fill the CRM number in External Document No., not Document No.

    Other thing I seen is a Commit between the header and the lines. Header fails validation, customer not coupled or whatever. But the lines still go in. So you get orphans. Keep both in one transaction, then a bad header takes the lines with it.

    Glad to help - follow up if anything is unclear.   

    ►  If this solved it, marking it verified helps others too.       

    Regards,
    Grigorios Mavrogeorgis
    Business Central Consultant & AL Developer

    Work: Gmsoft Limited
    Blog:  insidebusinesscentral
    LinkedIn: linkedin.com/in/gregorymavrogeorgis

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 626 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 425 Super User 2026 Season 2

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 384 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans