Share via


GetTaxScheduleDetailByKey

Description

Retrieves a tax detail object that is part of a tax schedule, based on the key values supplied.

Parameters

Parameter

Type

Description

key

TaxScheduleDetailKey

The tax schedule detail key object that specifies the tax schedule detail to retrieve.

context

Context

Specifies information about how the method will be called.

Return Value:

Value

Type

Description

GetTaxScheduleDetailByKeyResult

TaxScheduleDetail

A tax schedule detail object.

Interfaces

  • Dynamics GP
  • Common

Examples

The following C# example retrieves the tax schedule detail object for the tax detail "ILLINOIS" that is part of the tax schedule "USEXMT+PSONO". The calculation base is displayed in a message box.

Gg133635.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;
            TaxScheduleDetail taxScheduleDetail;
            TaxScheduleDetailKey taxScheduleDetailKey;
            TaxScheduleKey taxScheduleKey;
            TaxDetailKey taxDetailKey;

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

            // Be sure that default credentials are being 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
            context.OrganizationKey = (OrganizationKey)companyKey;

            // Create a tax schedule detail key
            taxScheduleKey = new TaxScheduleKey();
            taxScheduleKey.Id = "ILLINOIS";

            taxDetailKey = new TaxDetailKey();
            taxDetailKey.Id = "USEXMT+PSONO";

            taxScheduleDetailKey = new TaxScheduleDetailKey();
            taxScheduleDetailKey.TaxScheduleKey = taxScheduleKey;
            taxScheduleDetailKey.TaxDetailKey = taxDetailKey;

            // Get the tax schedule detail object
            taxScheduleDetail = wsDynamicsGP.GetTaxScheduleDetailByKey(taxScheduleDetailKey, context);

            // Display the calculation base for the tax schedule detail
            MessageBox.Show("Calculation base: " + taxScheduleDetail.TaxDetailBase.ToString());
        }
    }
}

Gg133635.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;
            TaxScheduleDetail taxScheduleDetail;
            TaxScheduleDetailKey taxScheduleDetailKey;
            TaxScheduleKey taxScheduleKey;
            TaxDetailKey taxDetailKey;

            // 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 tax schedule detail key
            taxScheduleKey = new TaxScheduleKey();
            taxScheduleKey.Id = "ILLINOIS";

            taxDetailKey = new TaxDetailKey();
            taxDetailKey.Id = "USEXMT+PSONO";

            taxScheduleDetailKey = new TaxScheduleDetailKey();
            taxScheduleDetailKey.TaxScheduleKey = taxScheduleKey;
            taxScheduleDetailKey.TaxDetailKey = taxDetailKey;

            // Get the tax schedule detail object
            taxScheduleDetail = wsDynamicsGP.GetTaxScheduleDetailByKey(taxScheduleDetailKey, context);

            // Display the calculation base for the tax schedule detail
            MessageBox.Show("Calculation base: " + taxScheduleDetail.TaxDetailBase.ToString());

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