Share via


GetManufacturingOrderByKey

Description

Retrieves a single manufacturing order object based on the specified manufacturing order document key.

Parameters

Parameter

Type

Description

key

ManufacturingOrderDocumentKey

The manufacturing order document key object that specifies the manufacturing order object to retrieve.

context

Context

Specifies information about how the method will be called.

Return Value:

Value

Type

Description

GetManufacturingOrderByKeyResult

ManufacturingOrder

A manufacturing order object.

Interfaces

  • Dynamics GP
  • Manufacturing

Examples

The following C# example retrieves a manufacturing order object with the manufacturing order document Id value "MO0001". A message box displays the manufacturing order Id and the description for that order.

Ff622653.LegacyEndpoint(en-us,MSDN.10).gif** Legacy endpoint**

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using DynamicsGPWebServiceSample.DynamicsGPService;

namespace DynamicsGPWebServiceSample
{
    class Program
    {
        static void Main(string[] args)
        {
            CompanyKey companyKey;
            Context context;
            ManufacturingOrder manufacturingOrder;
            ManufacturingOrderDocumentKey manufacturingOrderDocumentKey;

            // Create an instance of the service
            DynamicsGP wsDynamicsGP = new DynamicsGP();

            // Be sure the default credentials are used
            wsDynamicsGP.UseDefaultCredentials = true;

            // Create a context with which to call the service
            context = new Context();

            // Specify which company to use (sample company)
            companyKey = new CompanyKey();
            companyKey.Id = (-1);

            // Set up the context object
            context.OrganizationKey = (OrganizationKey)companyKey;

            // Create a manufacturing order document key
            manufacturingOrderDocumentKey = new ManufacturingOrderDocumentKey();
            manufacturingOrderDocumentKey.Id = "MO0001";

            // Get the specified manufacturing order object
            manufacturingOrder = wsDynamicsGP.GetManufacturingOrderByKey(manufacturingOrderDocumentKey, context);

            // Display the manufacturing order ID and the description of the order
            MessageBox.Show("Manufacturing Order: " + manufacturingOrder.ManufacturingOrderDocumentKey.Id
                + "   Description: " + manufacturingOrder.Description);
        }
    }
}

Ff622653.NativeEndpoint(en-us,MSDN.10).gif** Native endpoint **

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.Windows.Forms;
using DynamicsGPWebServiceSample.DynamicsGPService;

namespace DynamicsGPWebServiceSample
{
    class Program
    {
        static void Main(string[] args)
        {
            CompanyKey companyKey;
            Context context;
            ManufacturingOrder manufacturingOrder;
            ManufacturingOrderDocumentKey manufacturingOrderDocumentKey;

            // Create an instance of the service
            DynamicsGPClient wsDynamicsGP = new DynamicsGPClient();

            // Create a context with which to call the service
            context = new Context();

            // Specify which company to use (sample company)
            companyKey = new CompanyKey();
            companyKey.Id = (-1);

            // Set up the context object
            context.OrganizationKey = (OrganizationKey)companyKey;

            // Create a manufacturing order document key
            manufacturingOrderDocumentKey = new ManufacturingOrderDocumentKey();
            manufacturingOrderDocumentKey.Id = "MO0001";

            // Get the specified manufacturing order object
            manufacturingOrder = wsDynamicsGP.GetManufacturingOrderByKey(manufacturingOrderDocumentKey, context);

            // Display the manufacturing order ID and the description of the order
            MessageBox.Show("Manufacturing Order: " + manufacturingOrder.ManufacturingOrderDocumentKey.Id
                + "   Description: " + manufacturingOrder.Description);

            // Close the service
            if(wsDynamicsGP.State != CommunicationState.Faulted)
            {
                wsDynamicsGP.Close();
            }
        }
    }
}