Del via


GetVendorManufacturingOrderByKey

Description

Retrieves a single vendor 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 vendor manufacturing order object to retrieve.

context

Context

Specifies information about how the method will be called.

Return Value:

Value

Type

Description

GetVendorManufacturingOrderByKeyResult

VendorManufacturingOrder

A vendor manufacturing order object.

Interfaces

  • Dynamics GP
  • Manufacturing

Examples

The following C# example retrieves a vendor manufacturing order object with the key value "MO0001". A message box displays the Description property of the vendor manufacturing order object.

Ff622660.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;
            VendorManufacturingOrder vendorManufacturingOrder;
            ManufacturingOrderDocumentKey manufacturingOrderKey;

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

            // Be sure that 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
            manufacturingOrderKey = new ManufacturingOrderDocumentKey();
            manufacturingOrderKey.Id = "MO0001";

            // Get the vendor manufacturing order object
            vendorManufacturingOrder = wsDynamicsGP.GetVendorManufacturingOrderByKey(manufacturingOrderKey, context);

            // Display the description from the vendor manufacturing order
            MessageBox.Show("Order description: " + vendorManufacturingOrder.Description);
        }
    }
}

Ff622660.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;
            VendorManufacturingOrder vendorManufacturingOrder;
            ManufacturingOrderDocumentKey manufacturingOrderKey;

            // 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
            manufacturingOrderKey = new ManufacturingOrderDocumentKey();
            manufacturingOrderKey.Id = "MO0001";

            // Get the vendor manufacturing order object
            vendorManufacturingOrder = wsDynamicsGP.GetVendorManufacturingOrderByKey(manufacturingOrderKey, context);

            // Display the description from the vendor manufacturing order
            MessageBox.Show("Order description: " + vendorManufacturingOrder.Description);

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