GetPriceLevelList


Description

Retrieves a list of price level objects that match the specified criteria.

Parameters

Parameter

Type

Description

criteria

PriceLevelCriteria

A price level criteria object that specifies which price level objects to return.

context

Context

Specifies information about how the method will be called.


Return Value:

Value

Type

Description

GetPriceLevelListResult

ArrayOfPriceLevel

The list of price level objects that match the specified criteria.


Interfaces

 

Examples

The following C# example retrieves the list of price level objects with a created date value between “1/1/2003” and the current date. A message box displays the description from each price level object in the list.

 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;
			BetweenRestrictionOfNullableOfDateTime createdDateRestriction;
			PriceLevelCriteria priceLevelCriteria;
			PriceLevel[] priceLevels;

			// 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
			// Retrieve pricing level objects created since 1/1/2003 
			createdDateRestriction = new BetweenRestrictionOfNullableOfDateTime();
			createdDateRestriction.From = new DateTime(2003, 1, 1);
			createdDateRestriction.To = DateTime.Today;

			// Create the criteria object and specify the restriction
			priceLevelCriteria = new PriceLevelCriteria();
			priceLevelCriteria.CreatedDate = createdDateRestriction;

			// Retrieve the list of price level objects
			priceLevels = wsDynamicsGP.GetPriceLevelList(priceLevelCriteria, context);

			// Display the description property of each member of the object list
			StringBuilder summaryList = new StringBuilder();
			foreach (PriceLevel a in priceLevels)
			{
				summaryList.AppendLine("Price level description: " + a.Description);
		}
			MessageBox.Show(summaryList.ToString());
	}
}
}

 Native endpoint

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

namespace DynamicsGPWebServiceSample
{
	class Program
	{
		static void Main(string[] args)
		{
			CompanyKey companyKey;
			Context context;
			BetweenRestrictionOfNullableOfdateTime createdDateRestriction;
			PriceLevelCriteria priceLevelCriteria;
			PriceLevel[] priceLevels;

			// 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
			// Retrieve pricing level objects created since 1/1/2003 
			createdDateRestriction = new BetweenRestrictionOfNullableOfdateTime();
			createdDateRestriction.From = new DateTime(2003, 1, 1);
			createdDateRestriction.To = DateTime.Today;

			// Create the criteria object and specify the restriction
			priceLevelCriteria = new PriceLevelCriteria();
			priceLevelCriteria.CreatedDate = createdDateRestriction;

			// Retrieve the list of price level objects
			priceLevels = wsDynamicsGP.GetPriceLevelList(priceLevelCriteria, context);

			// Display the description property of each member of the object list
			StringBuilder summaryList = new StringBuilder();
			foreach (PriceLevel a in priceLevels)
			{
				summaryList.AppendLine("Price level description: " + a.Description);
		}
			MessageBox.Show(summaryList.ToString());

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


Documentation Feedback