Share via


GetPricingList

Description

Retrieves a list of pricing summary objects that match the specified criteria.

Parameters

Parameter

Type

Description

criteria

PricingCriteria

A pricing criteria object that specifies which pricing summary objects to retrieve.

context

Context

Specifies information about how the method will be called.

Return Value:

Value

Type

Description

GetPricingListResult

ArrayOfPricingSummary

The list of pricing summary objects that match the specified criteria.

Interfaces

  • Dynamics GP
  • Inventory

Examples

The following C# example retrieves the list of pricing summary objects where the PriceLevelId property equals "Retail". A message box displays the total number of pricing summary objects with the specified PriceLevelId.

Cc508513.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;
            LikeRestrictionOfString priceLevelIdRestriction;
            PricingCriteria pricingCriteria;
            PricingSummary[] pricingSummaries;

            // 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 the restriction object
            // Get the items with a price level Id of 'Retail'
            priceLevelIdRestriction = new LikeRestrictionOfString();
            priceLevelIdRestriction.EqualValue = "Retail";

            // Create a pricing criteria object
            pricingCriteria = new PricingCriteria();
            pricingCriteria.PriceLevelId = priceLevelIdRestriction;

            // Retrieve the list of pricing summary objects
            pricingSummaries = wsDynamicsGP.GetPricingList(pricingCriteria, context);

            // Display the total number of items with a price level Id of 'Retail'
            MessageBox.Show("Total number of retail priced items: " + pricingSummaries.Length.ToString());
        }
    }
}

Cc508513.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;
            LikeRestrictionOfstring priceLevelIdRestriction;
            PricingCriteria pricingCriteria;
            PricingSummary[] pricingSummaries;

            // 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 the restriction object
            // Get the items with a price level Id of 'Retail'
            priceLevelIdRestriction = new LikeRestrictionOfstring();
            priceLevelIdRestriction.EqualValue = "Retail";

            // Create a pricing criteria object
            pricingCriteria = new PricingCriteria();
            pricingCriteria.PriceLevelId = priceLevelIdRestriction;

            // Retrieve the list of pricing summary objects
            pricingSummaries = wsDynamicsGP.GetPricingList(pricingCriteria, context);

            // Display the total number of items with a price level Id of 'Retail'
            MessageBox.Show("Total number of retail priced items: " + pricingSummaries.Length.ToString());

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