Share via


UpdateSalesQuote

Description

Updates the specified sales quote object, storing the current values in the database.

Parameters

Parameter

Type

Description

salesQuote

SalesQuote

The sales quote object that is being updated.

context

Context

Specifies information about how the method will be called.

policy

Policy

Specifies the set of behaviors and behavior options to be applied during the operation.

Interfaces

  • Dynamics GP
  • Sales

Examples

The following C# example retrieves the sales quote with the sales document key value "QTEST1022" and sets the comment property to "Confirmed line items with customer". The UpdateSalesQuote operation saves the new comment and all the sales quote object's properties to the database.

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

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

namespace DynamicsGPWebServiceSample
{
    class Program
    {
        static void Main(string[] args)
        {
            CompanyKey companyKey;
            Context context;
            SalesDocumentKey documentKey;
            SalesQuote salesQuote;
            Policy salesQuoteUpdatePolicy;

            // 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 sales document key to specify the sales quote
            documentKey = new SalesDocumentKey();
            documentKey.Id = "QTEST1022";

            // Retrieve the sales quote object
            salesQuote = wsDynamicsGP.GetSalesQuoteByKey(documentKey, context);

            // Update the comment property
            salesQuote.Comment = "Confirmed line items with customer";

            // Get the update policy for sales quotes
            salesQuoteUpdatePolicy = wsDynamicsGP.GetPolicyByOperation("UpdateSalesQuote", context);

            // Update the sales quote object
            wsDynamicsGP.UpdateSalesQuote(salesQuote, context, salesQuoteUpdatePolicy);
        }
    }
}

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

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

namespace DynamicsGPWebServiceSample
{
    class Program
    {
        static void Main(string[] args)
        {
            CompanyKey companyKey;
            Context context;
            SalesDocumentKey documentKey;
            SalesQuote salesQuote;
            Policy salesQuoteUpdatePolicy;

            // 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 sales document key to specify the sales quote
            documentKey = new SalesDocumentKey();
            documentKey.Id = "QTEST1022";

            // Retrieve the sales quote object
            salesQuote = wsDynamicsGP.GetSalesQuoteByKey(documentKey, context);

            // Update the comment property
            salesQuote.Comment = "Confirmed line items with customer";

            // Get the update policy for sales quotes
            salesQuoteUpdatePolicy = wsDynamicsGP.GetPolicyByOperation("UpdateSalesQuote", context);

            // Update the sales quote object
            wsDynamicsGP.UpdateSalesQuote(salesQuote, context, salesQuoteUpdatePolicy);

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