Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

How to insert data in Table " Contact (5050) " for external APP

(0) ShareShare
ReportReport
Posted on by 65

Hi,

I have a external Application , can i instert data in Contact (5050) Table outside of Business Central  ?

Thanks.

  • Armando Northware  Profile Picture
    65 on at
    RE: How to insert data in Table " Contact (5050) " for external APP

    Thank you for your help and for sharing the links.

    =)

  • Verified answer
    jdecottignies Profile Picture
    217 on at
    RE: How to insert data in Table " Contact (5050) " for external APP

    Fine! :)

    I learnt this by calling BC api with PowerApps the first time, using standard API: you can find the documentation here:

    docs.microsoft.com/.../

    When I saw your question I went to this page to give you an answer (I think you went to there too). As there was no standard api for Contact, I thought that maybe api page could answers your question. I just made some tests following Customer api, but applying to my api page (contacts):

    docs.microsoft.com/.../dynamics_customer

    Also, I wen to NavTechDays2019, I used the notes from what I saw there, from the "{ConnectApp}² conference given by Waldo (his blog here: https://www.waldo.be/)

    The conference here: https://www.youtube.com/watch?v=9yg-8tLNjzg

    You can also see all the conference here: https://www.youtube.com/watch?v=pl0LAvep6WE&list=PLI1l3dMI8xlCkFC0S4q8VxPiBt30VQ4w0

    There is also a lot of blogs that can help you (as they help me), as:

    Stefano Demiliani's blog: https://demiliani.com/tag/dynamics-365-business-central/

    Vjeko's blog: http://vjeko.com/

    MyNav's blog (not mine, this is the name of the blog ;) ) : http://www.mynavblog.com/

    Freddy Kristiansen's blog: https://freddysblog.com/

    I gave you the ones I follow the most. You will find more.

    You can also type key words in the AL issues GitHub research: (https://github.com/Microsoft/AL/issues ). You will find some piece of code (for example) that can help you doing what you want.

    Google is also your friend, starting with "Business Central <you key words>", you will find maybe some piece of code, at least some clues to do what you want. As a puzzle game you will assemble what you find!

  • Armando Northware  Profile Picture
    65 on at
    RE: How to insert data in Table " Contact (5050) " for external APP

    Thanks .

    I could already make the POST and PATCH .

    Where did you learn all this? or where can I learn more about Business Central? .

  • Verified answer
    jdecottignies Profile Picture
    217 on at
    RE: How to insert data in Table " Contact (5050) " for external APP

    Yes, you should select a contact precisely, here you try to update a list.

    You have to reference the SystemId field in your Page API, and set the property ODataKeyField to SystemID. Your page should looks like this:

    page 50100 "API Contacts"
    {
        PageType = API;
        Caption = 'contact';
        APIPublisher = 'someApiPublisher';
        APIGroup = 'testapi';
        APIVersion = 'v1.0';
        EntityName = 'contact';
        EntitySetName = 'contacts';
        SourceTable = Contact;
        DelayedInsert = true;
        ODataKeyFields = SystemId; // <<< new property
        Editable = true;
    
        layout
        {
            area(Content)
            {
                repeater(GroupName)
                {
                    field(id; SystemId) // <<< new field reference
                    {
                        Caption = 'SystemId';
                        Editable = false;
                    }
                    field(name; Name)
                    {
                        Caption = 'name';
                    }
                    field(address; Address)
                    {
                        Caption = 'address';
                    }
                }
            }
        }
    }

    Then, make a Get request to your contacts/ endpoint.

    Look for the customer you want to modify

    copy the ETAG value

    copy the id Value (systemId)

    In the patch request, you need to specify the contact's systemId you want to update in the url. So Your Url should looks like this:

    http://.../companies(<companyId>)/contacts(<systemId>)

    In the Headers, you need to specify the Etag value in If-Match header:

    if in your response you got:

    "@odata.etag": "W/\"JzQ0O05LcU5NbitQREdPOTViWGlrWnBPYjlNYmxZY3BXc2RWREhiSXo1R0VuN0U9MHtPMDsn\""

    you'll have to remove the escape characters (\). In postman your If-Match header will be:

    W/"JzQ0O05LcU5NbitQREdPOTViWGlrWnBPYjlNYmxZY3BXc2RWREhiSXo1R0VuN0U9MHtPMDsn"

    Also provide as Header the following:

    Content-Type: "application/json"

    Accept: "application/json"

    Finaly in the body you provide the fields you want to update, for example:

    {
    "address": "updatedAddress"
    }

    Hit send and it should be ok

  • Armando Northware  Profile Picture
    65 on at
    RE: How to insert data in Table " Contact (5050) " for external APP

    Im use PATCH method and return this :

    {

       "error": {

           "code": "BadRequest_MethodNotAllowed",

           "message": "'PATCH' requests for 'contacts' of EdmType 'Collection' are not allowed within Dynamics 365 Business Central OData web services.  CorrelationId:  f86724-94f-429-9829-d83853db."

       }

    }

  • Armando Northware  Profile Picture
    65 on at
    RE: How to insert data in Table " Contact (5050) " for external APP

    No , but yo need in Contact the field "No." in  page extension you cant's use this column.

    "The name of field controls in pages of the type API must be alphanumeric.AL(AL0528) " o how to do the UPDATE

  • jdecottignies Profile Picture
    217 on at
    RE: How to insert data in Table " Contact (5050) " for external APP

    Did you try to use PATCH method instead of POST ?

  • Armando Northware  Profile Picture
    65 on at
    RE: How to insert data in Table " Contact (5050) " for external APP

    Thanks .

    I could already make the post .

    but  i need UPDATE data in the same way , how to do this?

  • jdecottignies Profile Picture
    217 on at
    RE: How to insert data in Table " Contact (5050) " for external APP

    In Sandbox environment you can use Basic authentication:

    Username = Your BC UserName in your user card page

    Password = API Key field of your user card.

    For production you'll need OAUTH Authentication

  • Armando Northware  Profile Picture
    65 on at
    RE: How to insert data in Table " Contact (5050) " for external APP

    Thanks , I could already make the post

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 > Small and medium business | Business Central, NAV, RMS

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 669

#2
YUN ZHU Profile Picture

YUN ZHU 646 Super User 2025 Season 1

#3
Mansi Soni Profile Picture

Mansi Soni 495

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans