Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Import Sales Order using Xmlport without Document No.

Posted on by 32,675

Hi,

i want to import a sales order with 1 sales line using a xmlport. it works, when i set the SalesHeader.No. and the SalesLine.DocumentNo in the xml import file.

but i also want to import a sales order without setting the no./document no. in the xml import file. the import mechanism should set the no./document no. automatically using the according no. series. i have done that by setting some code in the "Sales Header"-No - Import::OnAfterAssignField() Trigger and it works fine. the import creates a new document no., the sales header part is imported. but not the sales line part.

setting the document no. by code in the Line - Import::OnAfterInitRecord(), Line - Import::OnBeforeInsertRecord() or DocumentNo - Import::OnAfterAssignField() does not work. there is always an error message: Conflict between data and LineTable/LinkFields Setup in table Line.
LinkTable: Sales Header; LinkFields: Document No.=FIELD(No.)
(i also tried the LinkFields with Document Type=FIELD(Document Type);Document No.=FIELD(No.))

Every help will be appreciated. Thx.

*This post is locked for comments

  • Verified answer
    keoma Profile Picture
    keoma 32,675 on at
    RE: Import Sales Order using Xmlport without Document No.

    hi,

    i figured out that the solution is to remove the LinkFields Condition and set the Document No. of the sales line in the trigger DocumentNo - Import::OnAfterAssignField(). now it works.

  • Suggested answer
    Jens Glathe Profile Picture
    Jens Glathe 6,092 on at
    RE: Import Sales Order using Xmlport without Document No.

    Hi Jonathan,

    I would try to import the records into temporary tables, and write the contents (with the right primary key fields) in the OnPostXMLport() trigger to the database. This is fine as long as you have only one sales order in the XML file. Otherwise you could also assign the primary key you want in the OnPreXMLItem() triggers.

    with best regards

    Jens

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans