Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

how to create a contact using a NAV 2009 WebService

(0) ShareShare
ReportReport
Posted on by 105

Hello,

 

I'd like to create a contact using the Web Service exposed by the contact card.

The problem:

In NAV we have set automatic contact ID creation.

What do I need to pass as contact.no_ to the web service?

 

contact.no_ = ""     is bad, because the primary key is missing

contact.no_ = "99999" is bad, because I must not pass a contact number

 

Is there another property I need to set?

 

Thanks in advanced

Sascha

*This post is locked for comments

  • RE: how to create a contact using a NAV 2009 WebService

    You got the solution for this?

  • Neav Profile Picture
    Neav 105 on at
    Re: how to create a contact using a NAV 2009 WebService

    Hi Nick,

    I'm going to have a look at the table designer. Well, I can always try to add one field after the other, or first fill in the fields I want to fill in anyways and then go ahead and fill fields until NAV is satisfied.

    Thanks

    Sascha

  • Verified answer
    Nick Haman Profile Picture
    Nick Haman on at
    Re: how to create a contact using a NAV 2009 WebService

    Sascha,

    I do not know of a perfect way to know all required fields programatically. You have to look at key fields (even then like in your above example it may not be required based on setups), or look at code to see if any C/AL is requiring. In the end just going through the GUI if using a Page is probably the easiest or if a Codeunit, then just looking at code. Unless someone has come up with a better way, I do not know of a way to know for all possibilities. In the Table Designer if you export the tables, there is the NotBlank property you can look at, but again, that doesn't cover every scenario.

  • Neav Profile Picture
    Neav 105 on at
    Re: how to create a contact using a NAV 2009 WebService

    Hi Nick,

    thanks for the answer. Is there a way to find out the required fields that I need to pass to the Web Service? I tried just to pass in the contact type "company" and a name but I got an error saying that at least one field was missing.

    Thanks for your help

    Sascha

  • Verified answer
    Nick Haman Profile Picture
    Nick Haman on at
    Re: how to create a contact using a NAV 2009 WebService

    Sascha,

    Since the C/AL code is handling that, try to not pass the contact.no_ field at all, just comment that line out and set the other fields you want. The C/AL code should handle getting the key then to create a new record, at least in my testing that worked out just fine if just creating a single record.

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans