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, ...
Suggested Answer

Custom service with example

(0) ShareShare
ReportReport
Posted on by 994

Hi all,

I am exploring more on custom service and trying to set an example.

 

For example, Payroll system fetching employee leave balance 

 

1.Request class -

 

[DataContract]
public class LeaveBalanceRequest
{
   [DataMember]
   public str PersonnelNumber {"P007" }
}

 

Here The external payroll system

sends the employee personnel number.

 

2.Response class ,-

 

[DataContract]
public class LeaveBalanceResponse
{
   [DataMember]
   public int AvailableLeaveDays { get; set; }

   [DataMember]
   public str Message { get; set; }
}

 

Returns the leave balance

 

3.Service class -

 

public class LeaveService
{

     Method -  GetLeaveBalance()

     // To do

     // return response;
}

 

Accepts Request class, returns Response class.

 

4.Now the external system will call

 

POST https://<my devenv>.cloudax.dynamics.com/data/GetLeaveBalance
Authorization: Bearer <token>
Content-Type: application/json

{
 "request": {
   PersonnelNumber: "P007"
 }
}

 

5.Response 

 

{
 "AvailableLeaveDays": 12,
 "Message": "Employee P007has 12 leave days available"
}

Is my assumption correct?

Pls advise, thanks 

Categories:
I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    240,642 Most Valuable Professional on at

    The service looks correct, your URL doesn't. Please check out the documentation, Custom service development, to learn about the two endpoints you can use. You seem to be interested in the JSON-based one (https://<my devenv>.cloudax.dynamics.com/api/[service group]/[service]/GetLeaveBalance).

     

    By the way, I suggest you look at sample code from Microsoft and try to run it, so you see how the things work in practice. When you manage that, you can develop your own service and test it. You'll find the samples here: github.com/microsoft/Dynamics-AX-Integration/tree/master/ServiceSamples.

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

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

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

#1
Martin Dráb Profile Picture

Martin Dráb 361 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
CU10121822-0 Profile Picture

CU10121822-0 324

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans