Skip to main content

How to create work order in Dynamics 365 field service from external web application?

 To create a work order in Dynamics 365 Field Service from an external web application, you can use the Dynamics 365 Web API, which allows you to programmatically create, update, and retrieve data in Dynamics 365 Field Service.

Here are the high-level steps you can follow:

  1. Get an OAuth 2.0 access token to authenticate your API calls. You can use the OAuth 2.0 client credentials grant flow to obtain an access token.

  2. Use the Work Order entity in Dynamics 365 Field Service to create a new work order record. You will need to include the required fields and any additional fields you want to populate.

  3. Optionally, you can create related records for the work order, such as work order products, services, or notes.

Here is an example of how to create a work order using the Dynamics 365 Web API in JavaScript:

const token = "YOUR_ACCESS_TOKEN";const url = "";const workOrder = {  
msdyn_workordertype: {    
// specify the work order type
  msdyn_serviceaccount: {
    // specify the service account
  msdyn_service territory: {
    // specify the service territory
  // specify additional fields as needed
fetch(url, {  
method: "POST",
  headers: {
    "Authorization": `Bearer ${token}`,
    "Content-Type": "application/json"
  body: JSON.stringify(workOrder)
.then(response => {
  if (!response.ok) {
    throw new Error("Failed to create work order");
  return response.json();
.then(data => {
  console.log(`Work order created with ID ${data.msdyn_workorderid}`);
.catch(error => {

This example assumes you have obtained an access token using the client credentials grant flow and have populated the required and optional fields for the work order. You can adapt this example to your specific needs and integrate it into your web application as needed.


Popular posts from this blog

Scenarios to replace Dynamics 365 plugins with Power Automate Flow

  Here are a few scenarios where you might consider replacing Dynamics 365 plugins with Power Automate Flow: Triggering actions based on external events: If you need to trigger actions in Dynamics 365 based on events that occur outside of the system, such as when a customer submits a form on your website, you can use Power Automate Flow to automate these actions. Integrating with external systems: If you need to integrate Dynamics 365 with external systems, such as a marketing automation tool or an accounting system, Power Automate Flow can help you automate these integrations. Sending notifications: If you need to send notifications based on events that occur in Dynamics 365, such as when a new lead is added, Power Automate Flow can help you automate this process. Data migration: If you need to migrate data from one Dynamics 365 environment to another, you can use Power Automate Flow to automate this process. Data synchronization: If you need to synchronize data between Dynamics 365

Use cases for implementing Dynamics 365 Field Service

Dynamics 365 Field Service is a powerful tool that can help organizations improve their field service operations by streamlining processes, reducing downtime, and improving customer satisfaction. Here are a few examples of use cases where implementing Dynamics 365 Field Service can be beneficial: Equipment maintenance: If your organization relies on equipment that requires regular maintenance and repairs, Dynamics 365 Field Service can help you schedule and dispatch technicians more efficiently. By using real-time data from IoT sensors, you can proactively identify issues before they become major problems and schedule maintenance visits accordingly. Service scheduling: If your organization provides on-site services such as installation, repair, or maintenance, Dynamics 365 Field Service can help you optimize your scheduling process. With the ability to manage work orders, dispatch technicians, and track service history, you can ensure that your customers receive prompt and efficient

To create chatbot using Power Virtual Agent and integrate it in Power Pages Portal

Here is the process of creating a chatbot using Power Virtual Agents and integrating it in Power Pages. Here are the steps you need to follow: Create a new Power Virtual Agents bot by going to the Power Platform Admin Center and clicking on "Create a resource". Select "Power Virtual Agents" and follow the prompts to create a new bot. Design and build your chatbot in Power Virtual Agents by creating topics, adding triggers, and designing conversation flows. You can also add custom code if needed. Once your chatbot is built, publish it to make it available for integration with other applications. Next, create a new Power Page or open an existing one where you want to integrate your chatbot. In the Power Page editor, add the Power Virtual Agents web chat control to the page. You can find this control under "Insert" > "More controls" > "Power Virtual Agents". Configure the web chat control by entering the URL of your published chatbot