DynDeveloper.com

DynDeveloper.com

Sign Up Now!Log In
woodsdarren 5/9/2012 2:44:21 PM

Web Services - Item List Price

I am using GetItemByKey and I need to get the List Price for the item.  The pricing method is % List and there is only one price level assigned.  I am using GetPricingByKey.  I have assigned the keys and I get this far:

public static Pricing getIVPricing(int CompanyId, string itemNumber, string priceLevel, string uom)
{

PricingKey pricingKey;
Pricing pricing; 
 
//Get Web Service
DynamicsGPClient wsDynamicsGP = Globals.getWebServiceReference();

// Create a context with which to call the service
Context context = Globals.getContext(CompanyId); 
 
// Create a pricing key to specify the pricing object
pricingKey = new PricingKey();
pricingKey.ItemKey = new ItemKey { Id = itemNumber };
pricingKey.PriceLevelKey = new PriceLevelKey { Id = priceLevel };
pricingKey.CurrencyKey = new CurrencyKey { ISOCode = "USD" };
pricingKey.UofM = uom;

// Get the specified pricing object
pricing = wsDynamicsGP.GetPricingByKey(pricingKey, context); 
 
return pricing;
 

}
 

But then when I try get the amount..

pricing.Details[0].UofMPrice.Item

I get a conversion error involving a percent.  I understand that 'Item' is a MoneyPercentChoice and can handle this when updating or creating, but I am not sure what to do when trying to retrive the List Price amount.  Can someone help?  I am sure this is something easy I am missing.

Thanks,

Darren

Version: GP 2010
Section: Web Services