0

I'm trying to update an Item on QBO through the c# SDK provided by Intuit. The Unit Price is not getting updated, even though I am specifying it in the request. The request JSON is:

{
  "SalesTaxCodeRef": {
    "name": "Sales Tax",
    "value": "2"
  },
  "Id": "37",
  "Name": "Item XALEIVJSLZ",
  "Description": "Sales Description",
  "Active": true,
  "Taxable": true,
  "UnitPrice": 11,
  "RatePercent": 5,
  "Type": "Inventory",
  "IncomeAccountRef": {
    "name": "Sales",
    "value": "1"
  },
  "PurchaseDesc": "Purchase Description",
  "PurchaseCost": 17.8,
  "ExpenseAccountRef": {
    "name": "Purchases",
    "value": "55"
  },
  "AssetAccountRef": {
    "name": "Inventory Asset",
    "value": "58"
  },
  "SyncToken": "0",
  "sparse": true
}

and the response JSON is

{
  "Item": {
    "Name": "Item XALEIVJSLZ",
    "Description": "Sales Description",
    "Active": true,
    "FullyQualifiedName": "Item XALEIVJSLZ",
    "Taxable": true,
    "UnitPrice": 5,
    "Type": "Service",
    "IncomeAccountRef": {
      "value": "1",
      "name": "Sales"
    },
    "PurchaseDesc": "Purchase Description",
    "PurchaseCost": 17.8,
    "ExpenseAccountRef": {
      "value": "55",
      "name": "Purchases"
    },
    "TrackQtyOnHand": false,
    "domain": "QBO",
    "sparse": false,
    "Id": "37",
    "SyncToken": "1",
    "MetaData": {
      "CreateTime": "2014-07-07T20:26:25-07:00",
      "LastUpdatedTime": "2014-07-07T20:26:35-07:00"
    }
  },
  "time": "2014-07-07T20:26:35.804-07:00"
}
Deduplicator
  • 44,692
  • 7
  • 66
  • 118

1 Answers1

0

Not sure what is the issue. I can easily update the Unit price-

<Item xmlns="http://schema.intuit.com/finance/v3" sparse="false">
 <Id>6</Id>
  <SyncToken>0</SyncToken>
  <MetaData>
    <CreateTime>2014-07-07T23:52:51-07:00</CreateTime>
    <LastUpdatedTime>2014-07-07T23:52:52-07:00</LastUpdatedTime>
  </MetaData>
  <Name>invento1</Name>
  <Active>true</Active>
  <FullyQualifiedName>invento1</FullyQualifiedName>
  <Taxable>false</Taxable>
  <SalesTaxIncluded>false</SalesTaxIncluded>
  <UnitPrice>35</UnitPrice>
  <Type>Inventory</Type>
  <IncomeAccountRef name="Sales of Product Income">20</IncomeAccountRef>
  <PurchaseTaxIncluded>false</PurchaseTaxIncluded>
  <PurchaseCost>0</PurchaseCost>
  <ExpenseAccountRef name="Cost of Goods Sold">21</ExpenseAccountRef>
  <AssetAccountRef name="Inventory Asset">22</AssetAccountRef>
  <TrackQtyOnHand>true</TrackQtyOnHand>
  <QtyOnHand>44</QtyOnHand>
  <InvStartDate>2014-07-08</InvStartDate>
</Item>

Response-

<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2014-07-07T23:55:11.473-07:00">
  <Item domain="QBO" sparse="false">
<Id>6</Id>
<SyncToken>1</SyncToken>
<MetaData>
  <CreateTime>2014-07-07T23:52:51-07:00</CreateTime>
  <LastUpdatedTime>2014-07-07T23:55:11-07:00</LastUpdatedTime>
</MetaData>
<Name>invento1</Name>
<Active>true</Active>
<FullyQualifiedName>invento1</FullyQualifiedName>
<Taxable>false</Taxable>
<SalesTaxIncluded>false</SalesTaxIncluded>
<UnitPrice>35</UnitPrice>
<Type>Inventory</Type>
<IncomeAccountRef name="Sales of Product Income">20</IncomeAccountRef>
<PurchaseTaxIncluded>false</PurchaseTaxIncluded>
<PurchaseCost>0</PurchaseCost>
<ExpenseAccountRef name="Cost of Goods Sold">21</ExpenseAccountRef>
<AssetAccountRef name="Inventory Asset">22</AssetAccountRef>
<TrackQtyOnHand>true</TrackQtyOnHand>
<QtyOnHand>44</QtyOnHand>
<InvStartDate>2014-07-08</InvStartDate>

I see a lot of issues in your request. How are you setting the type as Inventory when TrackQtyOnHand,InvStartDate, QtyOnHand is not specified?

Here is the correct way of creating an Inventory item. Item item1 = new Item();

                        item1.Name = "InventoryTest3" ;
                        item1.FullyQualifiedName = "InventoryTest3";
                        item1.Description = "Description";
                        item1.Active = true;
                        item1.ActiveSpecified = true;
                        item1.Taxable = true;
                        item1.TaxableSpecified = true;
                        item1.UnitPrice = 10.00m;
                        item1.Type = ItemTypeEnum.Inventory;
                        item1.IncomeAccountRef = new ReferenceType() { Value="63" };
                        item1.PurchaseCost = 24.00m;
                        item1.PurchaseCostSpecified = true;
                        item1.ExpenseAccountRef = new ReferenceType() { Value = "64" };
                        item1.AssetAccountRef = new ReferenceType() { Value = "65" };
                        item1.TrackQtyOnHand = true;
                        item1.TrackQtyOnHandSpecified = true;
                        item1.QtyOnHand = 90;
                        item1.QtyOnHandSpecified = true;
                        item1.InvStartDate = DateTime.Now.Date;
                        item1.InvStartDateSpecified = true;
                        Item itemAdded = commonServiceQBO.Add<Item>(item1);

Once the correct item is created, then try a full update on the item. Sparse update is not supported https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/030_entity_services_reference/item

nimisha shrivastava
  • 2,357
  • 2
  • 16
  • 31