Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Description
Retrieves a list of changed pricing key objects for the pricing objects that have been acted on during the specified interval. A pricing object 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 |
The pricing changed key criteria object that specifies which changed pricing key objects to return. |
|
context |
Specifies information about how the method will be called. |
Return Value:
Value |
Type |
Description |
|---|---|---|
GetChangedPricingKeyListResult |
The list of changed pricing key objects that match the specified criteria. |
Interfaces
- Dynamics GP
Examples
The following C# example retrieves the list of the changed pricing key objects for all of the pricing actions that have occurred over the last week for the inventory item 1-A3261A. A message box displays the number of actions of each type that were performed.
** 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;
PricingChangedKeyCriteria pricingCriteria;
ChangedPricingKey[] changedPricingKeyObjects;
BetweenRestrictionOfNullableOfDateTime restriction;
BetweenRestrictionOfString itemRestriction;
// 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 the last week
restriction = new BetweenRestrictionOfNullableOfDateTime();
restriction.From = DateTime.Today.Date.AddDays(-7);
restriction.To = DateTime.Today.Date.AddDays(1);
// Restrict the pricing to a single item
itemRestriction = new BetweenRestrictionOfString();
itemRestriction.EqualValue = "1-A3261A";
// Create the criteria to return pricing objects that changed
pricingCriteria = new PricingChangedKeyCriteria();
pricingCriteria.LastModifiedDate = restriction;
pricingCriteria.ItemKeyId = itemRestriction;
// Retrieve the changed pricing key objects
changedPricingKeyObjects = wsDynamicsGP.GetChangedPricingKeyList(pricingCriteria, context);
// Display the numbers of sales orders that were acted on this week
int created = 0;
int updated = 0;
int deleted = 0;
foreach (ChangedPricingKey key in changedPricingKeyObjects)
{
if (key.Action == DataModificationAction.Created)
created++;
if (key.Action == DataModificationAction.Updated)
updated++;
if (key.Action == DataModificationAction.Deleted)
deleted++;
}
string message;
message = "Pricing changes for 1-A3261A: \n";
message = message + "Created: " + created.ToString() + "\n";
message = message + "Updated: " + updated.ToString() + "\n";
message = message + "Deleted: " + deleted.ToString() + "\n";
MessageBox.Show(message);
}
}
}
** 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;
PricingChangedKeyCriteria pricingCriteria;
ChangedPricingKey[] changedPricingKeyObjects;
BetweenRestrictionOfNullableOfdateTime restriction;
BetweenRestrictionOfstring itemRestriction;
// 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 the last week
restriction = new BetweenRestrictionOfNullableOfdateTime();
restriction.From = DateTime.Today.Date.AddDays(-7);
restriction.To = DateTime.Today.Date.AddDays(1);
// Restrict the pricing to a single item
itemRestriction = new BetweenRestrictionOfstring();
itemRestriction.EqualValue = "1-A3261A";
// Create the criteria to return pricing objects that changed
pricingCriteria = new PricingChangedKeyCriteria();
pricingCriteria.LastModifiedDate = restriction;
pricingCriteria.ItemKeyId = itemRestriction;
// Retrieve the changed pricing key objects
changedPricingKeyObjects = wsDynamicsGP.GetChangedPricingKeyList(pricingCriteria, context);
// Display the numbers of sales orders that were acted on this week
int created = 0;
int updated = 0;
int deleted = 0;
foreach (ChangedPricingKey key in changedPricingKeyObjects)
{
if (key.Action == DataModificationAction.Created)
created++;
if (key.Action == DataModificationAction.Updated)
updated++;
if (key.Action == DataModificationAction.Deleted)
deleted++;
}
string message;
message = "Pricing changes for 1-A3261A: \n";
message = message + "Created: " + created.ToString() + "\n";
message = message + "Updated: " + updated.ToString() + "\n";
message = message + "Deleted: " + deleted.ToString() + "\n";
MessageBox.Show(message);
// Close the service
if(wsDynamicsGP.State != CommunicationState.Faulted)
{
wsDynamicsGP.Close();
}
}
}
}