Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Answered

API - Retrieve Customer Record By No Rather Than SystemId

(0) ShareShare
ReportReport
Posted on by 2,469

Hi All

APIV2 examples use SystemId (guid) of the record to retrive by passing it as below:

GET businesscentralPrefix/companies({id})/customers({id})

GET businesscentralPrefix/companies({id})/customers({f2a5738a-44e3-ea11-bb43-000d3a2feca1})

Is there a way to create an endpoint to retrieve records by "No," such as customer number below:

GET businesscentralPrefix/companies({id})/customers({10000})

For a record in Cronus

"id": "f2a5738a-44e3-ea11-bb43-000d3a2feca1",

"number": "10000",

"displayName": "Adatum Corporation", "type": "Company", "addressLine1": "192 Market Square", "addressLine2": "", "city": "Atlanta", "state": "GA", "country": "US", "postalCode": "31772", "phoneNumber": "", "email": "robert.townes@contoso.com", "website": "", "taxLiable": true, "taxAreaId": "90196a90-44e3-ea11-bb43-000d3a2feca1", "taxAreaDisplayName": "ATLANTA, GA", "taxRegistrationNumber": "", "currencyId": "00000000-0000-0000-0000-000000000000", "currencyCode": "USD", "paymentTermsId": "04a5738a-44e3-ea11-bb43-000d3a2feca1", "shipmentMethodId": "00000000-0000-0000-0000-000000000000", "paymentMethodId": "3b196a90-44e3-ea11-bb43-000d3a2feca1", "blocked": " ", "lastModifiedDateTime": "2020-08-21T07:38:44.293Z"

  • Verified answer
    YUN ZHU Profile Picture
    YUN ZHU 74,115 Super User 2024 Season 2 on at
    RE: API - Retrieve Customer Record By No Rather Than SystemId

    Hi, you can do it.

    But this need to create a new custom API page.

    For example:

    pastedimage1647561651793v1.png

    pastedimage1647561662410v2.png

    Test Code:

    page 50102 "ZY Customers"
    {
        Caption = 'ZY Customers';
        APIGroup = 'app1';
        APIPublisher = 'zy';
        APIVersion = 'v2.0';
        DelayedInsert = true;
        EntityName = 'zyCustomer';
        EntitySetName = 'zyCustomers';
        PageType = API;
        SourceTable = Customer;
    
        layout
        {
            area(content)
            {
                repeater(General)
                {
                    field(number; Rec."No.")
                    {
                        Caption = 'Customer NO.';
                    }
                    field(name; Rec.Name)
                    {
                        Caption = 'Customer Name';
                    }
                }
            }
        }
    }

    Test EndPoint: api.businesscentral.dynamics.com/.../zyCustomers('10000')

    Hope this will help.

    Thanks.

    ZHU

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 Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans