Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Import excel.csv into Dynamics Nav 2017

(0) ShareShare
ReportReport
Posted on by

It was successful imported as a message box but the field was not. What should I do. Thankz

*This post is locked for comments

  • Verified answer
    keoma Profile Picture
    32,727 on at
    RE: Import excel.csv into Dynamics Nav 2017

    a check if the contact already exists is missing.

    you can use following:

    // the xmlport

    Node Name Prefix Node Type Source Type Data Source

    Root Element Text <Root>

    Contact Element Table <Contact>(Contact)

    SalCode Element Field Contact::Salutation Code

    FirstName Element Field Contact::First Name

    MiddleName Element Field Contact::Middle Name

    Surname Element Field Contact::Surname

    Address Element Field Contact::Address

    City Element Field Contact::City

    MobilePhone Element Field Contact::Mobile Phone No.

    Email Element Field Contact::E-Mail

    SalesPerson Element Field Contact::Salesperson Code

    // the trigger code

    // create a local var. contact2 / record / Contact

    Contact - Import::OnBeforeInsertRecord()

    Contact.Type := Contact.Type::Person;

    contact2.SETRANGE("First Name",Contact."First Name");

    contact2.SETRANGE(Surname,Contact.Surname);

    contact2.SETRANGE(Address,Contact.Address);

    contact2.SETRANGE(City,Contact.City);

    contact2.SETRANGE("E-Mail",Contact."E-Mail");

    IF contact2.FINDFIRST THEN BEGIN

     MESSAGE('Contact "' + Contact."First Name" + ' ' + Contact.Surname + ' already exists. Skipping ...');

     currXMLport.SKIP;

    END;

  • Community Member Profile Picture
    on at
    RE: Import excel.csv into Dynamics Nav 2017

    Please check the right question below. Thanks

  • Community Member Profile Picture
    on at
    RE: Import excel.csv into Dynamics Nav 2017

    I have a xmlport called Import contact list. Contains Salutation Code, FirstName,MiddleName,Surname, Address, City, MobilePhoneNo, Email,SalesPersonCode.
    It keeps importing duplicate after double click.

    code
    OnPostXMLport()

    MESSAGE ('Contact(s) importations successful');

    Contact - Import: :OnBeforeInsertRecord()

    employerrec .RESET;
    IF employerrec .GET(Contact."Company No.")= FALSE
    THEN ERROR ('Invalid Employer code for ' + Contact.Surname +' ' + Contact."First Name" +' '+ Contact."Middle Name" );
    Contact."Company Name":=employerrec."Company Name PenCom";

  • keoma Profile Picture
    32,727 on at
    RE: Import excel.csv into Dynamics Nav 2017

    please describe more details.

  • Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at
    RE: Import excel.csv into Dynamics Nav 2017

    Without see the code (or what you’ve done) it’s difficult to help you...

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics NAV (Archived)

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans