web
You’re offline. This is a read only version of the page.
close
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?

I have the same question (0)
  • Verified answer
    André Arnaud de Calavon Profile Picture
    301,035 Super User 2025 Season 2 on at

    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.

  • Suggested answer
    Sukrut Parab Profile Picture
    71,710 Moderator on at

    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 .

  • CSafwat Profile Picture
    90 on at

    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. 

  • Verified answer
    Sukrut Parab Profile Picture
    71,710 Moderator on at

    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.

  • Verified answer
    WillWU Profile Picture
    22,361 on at

    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.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 565 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 450 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans