Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

How to call a class in Finance and operations inside an API ?

(0) ShareShare
ReportReport
Posted on by 90

We want to make an API to retrieve data from Finance and Operations then we will call it in Field Service. In the API we want to call a class from Finance and Operations to apply some business logic to the data.

So, anyone can help me how can we do that?

  • Verified answer
    WillWU Profile Picture
    22,352 on at
    RE: How to call a class in Finance and operations inside an API ?

    Hi CSafwat,

    You could use custom services to access AX business logic from outside, and you can create data contract for the custom service.

    Please see the DOC:docs.microsoft.com/.../walkthrough-exposing-an-x-class-as-a-data-contract

    It's applicable to D365fo as well, although it's a document of ax2012.

    Hope this helps.

  • Verified answer
    Sukrut Parab Profile Picture
    71,682 Moderator on at
    RE: How to call a class in Finance and operations inside an API ?

    You can  call existing business logic  in custom action or in custom service  and i do agree with Andre about using custom service for your requirement. Take a  look at the below links to see example of both

    Custom service -

    vishwad365fo.blogspot.com/.../custom-service-to-create-sales-order.html

    daxonline.org/1580-simple-custom-service-implementation-example-d365.html

    Odata action

    vishwad365fo.blogspot.com/.../testing-odata-actions-in-d365.html

    The standard documentation linked by Andre has some examples as well. In those you will find a link for github projects which will give you some more examples.

  • CSafwat Profile Picture
    90 on at
    RE: How to call a class in Finance and operations inside an API ?

    Thanks André and Sukrut for your reply.

    To be more dedicated, we would like to use several validation methods from Dynamics 365 F&O itself. Could we use the existing methods and classes from Dynamics 365 F&O or we have to read and reapply the business logic from scratch? 

    If Yes, could you give me code example or a tutorial to follow?

    If No, What is the best solution as we are integrating between Dynamics 365 (Field Services) and Dynamics 365 F&O and we have lots of validations that must be checked before posting a transaction. 

  • Suggested answer
    Sukrut Parab Profile Picture
    71,682 Moderator on at
    RE: How to call a class in Finance and operations inside an API ?

    There are lot of ways to do that . Take a look at integration statergy link below

    docs.microsoft.com/.../integration-overview

    You  can write a custom service or create data entity and use it in odata .

  • Verified answer
    André Arnaud de Calavon Profile Picture
    294,336 Super User 2025 Season 1 on at
    RE: How to call a class in Finance and operations inside an API ?

    Hi CSafwat,

    You have two options here:

    - Create a data entity with actions -> docs.microsoft.com/.../odata

    - Create a custom service -> docs.microsoft.com/.../custom-services

    When I read your question, I think the second option would better meet your requirements. Microsoft is using the same for the Timesheet app where it communicates with a custom service.

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March 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... 294,336 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 233,025 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans