Quantcast
Channel: Microsoft Dynamics GP Forum - Recent Threads
Viewing all articles
Browse latest Browse all 45450

Validation Errors: - StandardCost cannot be less than 0

$
0
0

Hi All,

I am trying to create an sales item with the following php code but I got the error that said: "A validation exception has occurred. Validation Errors: - StandardCost cannot be less than 0. ".

$salesItem = new \SalesItem();

$salesItem->setKey($itemKey);
$salesItem->setDescription("Hyster E30Z Forklift, Elec, 3000lb Cap, Cushion, 3 Stg Mast, 88/198"); //char(101)
$salesItem->setShortDescription("Hyster E30Z Forklift"); //char(15)
$salesItem->setClassKey($classKey);
$salesItem->setType(\ItemType::SalesItem);

$salesItem->setUofMScheduleKey($unitOfMeasureKey);
$salesItem->setCreatedDate(new DateTime('2015-01-07', new DateTimeZone('America/New_York'))); //warehouse date
$salesItem->setSalesTaxBasis(\SalesTaxBasis::BasedOnCustomer);

$salesItem->setQuantities($arrayOfSalesItemWarehouse);

$salesItem->setQuantityDecimalPlaces(\QuantityDecimalPlaces::Five);
$salesItem->setCurrencyDecimalPlaces(\CurrencyDecimalPlaces::Five);

$salesItem->setValuationMethod(\ValuationMethod::FIFOPerpetual);

$currentCost = new \MoneyAmount((float)1000.00, 5);
$currentCost->setCurrency('USD');
$salesItem->setCurrentCost($currentCost);


$standardCost = new \MoneyAmount((float)1000.00, 5);
$standardCost->setCurrency('USD');
$salesItem->setStandardCost($standardCost);

As you can see I did put cost value to the soap request but I still got that error. I could not figure it out the reason. I also googled online a lot without any luck.

Thanks for you help!


Viewing all articles
Browse latest Browse all 45450

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>