GetChangedPriceLevelKeyList


Description

Retrieves a list of changed price level key objects for the price levels that have been acted on during the specified interval. A price level has been acted on if it has been created, updated, or deleted. Entity change tracking must be enabled for this method to return valid results.

Parameters

Parameter

Type

Description

criteria

PriceLevelChangedKeyCriteria

The price level changed key criteria object that specifies which changed price level key objects to return.

context

Context

Specifies information about how the method will be called.


Return Value:

Value

Type

Description

GetChangedPriceLevelKeyListResult

ArrayOfChangedPriceLevelKey

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


Interfaces

 

Examples

The following C# example retrieves the list of the changed price level key objects for all of the price levels that have been acted on during the current day. The data modification action restriction is used so that only update actions are included in the list returned. A message box displays the number of price levels that were updated.

 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;
			PriceLevelChangedKeyCriteria priceLevelCriteria;
			ChangedPriceLevelKey[] changedPriceLevelKeyObjects;
			BetweenRestrictionOfNullableOfDateTime restriction;
			RestrictionOfDataModificationAction dataModificationRestriction;

			// 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 that defines the interval examined for changes
			// The following restriction includes all of today
			restriction = new BetweenRestrictionOfNullableOfDateTime();
			restriction.From = DateTime.Today.Date;
			restriction.To = DateTime.Today.Date.AddDays(1);

			// Create the restriction so only updated price levels are returned
			dataModificationRestriction = new RestrictionOfDataModificationAction();
			dataModificationRestriction.EqualValue = DataModificationAction.Updated;

			// Create the criteria to return price level objects that were updated
			priceLevelCriteria = new PriceLevelChangedKeyCriteria();
			priceLevelCriteria.LastModifiedDate = restriction;
			priceLevelCriteria.Action = dataModificationRestriction;

			// Retrieve the changed price level key objects
			changedPriceLevelKeyObjects = wsDynamicsGP.GetChangedPriceLevelKeyList(priceLevelCriteria, context);

			// Display the number of price level objects that were updated today
			MessageBox.Show("Updated price level objects: " + changedPriceLevelKeyObjects.Length.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;
			PriceLevelChangedKeyCriteria priceLevelCriteria;
			ChangedPriceLevelKey[] changedPriceLevelKeyObjects;
			BetweenRestrictionOfNullableOfdateTime restriction;
			RestrictionOfDataModificationAction dataModificationRestriction;

			// 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 that defines the interval examined for changes
			// The following restriction includes all of today
			restriction = new BetweenRestrictionOfNullableOfdateTime();
			restriction.From = DateTime.Today.Date;
			restriction.To = DateTime.Today.Date.AddDays(1);

			// Create the restriction so only updated price levels are returned
			dataModificationRestriction = new RestrictionOfDataModificationAction();
			dataModificationRestriction.EqualValue = DataModificationAction.Updated;

			// Create the criteria to return price level objects that were updated
			priceLevelCriteria = new PriceLevelChangedKeyCriteria();
			priceLevelCriteria.LastModifiedDate = restriction;
			priceLevelCriteria.Action = dataModificationRestriction;

			// Retrieve the changed price level key objects
			changedPriceLevelKeyObjects = wsDynamicsGP.GetChangedPriceLevelKeyList(priceLevelCriteria, context);

			// Display the number of price level objects that were updated today
			MessageBox.Show("Updated price level objects: " + changedPriceLevelKeyObjects.Length.ToString());

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


Documentation Feedback