web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Custom Services for Retrieving Customer Details

(0) ShareShare
ReportReport
Posted on by 276

Hi team,

 

I have a scenario where an external system sends a customer account number to D365FO and expects to receive the corresponding customer details, such as the customer name and the sales orders associated with that customer etc…

 

So, i believed the best approach would be the custom services. 

 

Because, what I think…

 

The external system sends the customer account number as input to our custom API. 

Our X++ service class retrieves the customer details and related sales orders, then returns the response as output to the External system.

 

Is am I correct?

 

Is there any alternative solution?

 

Pls advise, thanks 

 

 

Categories:
  • Verified answer
    Layan Jwei Profile Picture
    8,428 Super User 2026 Season 2 on at

    Hi,

     

    Yes custom service could be an option correct. 

     

    We have other options but first we need to know more details:

     

    What info do you need about sales orders, is it header and lines?

     

    Do they need the data returned in real time? And who decided that they want to send customerId and get data back? Just to understand the business 

     

    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future.

  • Suggested answer
    Martin Dráb Profile Picture
    241,656 Most Valuable Professional on at

    The usual approach is not developing anything and simply querying data entities via OData.

     

    But if you find the investment worth it, you surely can get a custom service developed.

  • Verified answer
    André Arnaud de Calavon Profile Picture
    308,274 Super User 2026 Season 2 on at

    Hi,

    Can you please tell us more about the external system? Is it expecting only one message with all details about the customers and sales orders? If so, what is the required format?
    Is the system also able to interact with the OData protocol? Are they also open to using other integration services, such as Logic Apps?

    Note that a custom service can return all details in one message, but it requires a customization and future maintenance and validation with updates.

    If the external system can send and receive details with multiple calls, OData is available.

    If a fixed file format is required, instead of development, you can also use integration platforms that will query the data from F&O using OData and transforms it into the required format. These tools do have additional license or consumption costs.

  • Verified answer
    CU-1234529-002 Profile Picture
    631 on at

    Yes, a custom service is a valid approach if you need a single, controlled API that returns customer details plus related sales orders in one response.

    Create an X++ service class with a request contract containing CustomerAccount and a response contract containing customer fields and a list of sales-order details. Expose it as a JSON custom service and call it from the external system using the D365 F&O service endpoint with appropriate authentication.

    However, first consider standard OData:

    Query CustomersV3 by CustomerAccount for customer details.

    Query SalesOrderHeadersV2 filtered by OrderingCustomerAccount or InvoiceCustomerAccount for related orders.

    Use OData if the external system can make two or more calls and only needs standard fields. Use a custom service if you need one call, custom validation, calculated fields, pagination, or a combined customer + orders response.

    For a custom service, return only required fields, validate the customer exists, handle no-record and permission errors cleanly, and avoid returning large unbounded sales order lists add paging or a date/status filter.

  • CU29091230-0 Profile Picture
    276 on at

    Thanks for the response 

     

    CU-1234529-002

    As mentioned "Yes, a custom service is a valid approach if you need a single, controlled API that returns customer details plus related sales orders in one response.

    Create an X++ service class with a request contract containing CustomerAccount and a response contract containing customer fields and a list of sales-order details. Expose it as a JSON custom service and call it from the external system using the D365 F&O service endpoint with appropriate authentication.".

     

     

    Please let me know if required two way communication then which approach is best.

     

     

    Pls advise, thanks 

     

     

     

  • Verified answer
    Martin Dráb Profile Picture
    241,656 Most Valuable Professional on at

    It depends on what you mean by two-way communication. The topic of this thread, as you described it above, is a custom service getting an account number as a parameter and retuning some data to the caller. Therefore the communications is started by the other system and F&O responds with the data.

     

    If you also want to ask how F&O could call web service offered by other application, it's off-topic here. Create a new thread instead and explain what exactly you want to learn.

     

    If you're fine with information your got Custom Services for Retrieving Customer Details, please verify the answer(s). If not, tell us what else you need before you'll consider this question answered.

  • CU29091230-0 Profile Picture
    276 on at

    Sure Martin 

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 266 Super User 2026 Season 2

#2
Aayush Tiwari Profile Picture

Aayush Tiwari 217

#3
Subra Profile Picture

Subra 164 Super User 2026 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans