Blair Connolly
Blair Connolly

Reputation: 604

Trying to create a TimeActivity, sync errors unless I use EmployeeName/CustomerName or the QB Id instead of the NG Id

I am sending proper XML (pretty sure, see below) but the sync fails with a message of "QBXML validation error: [severity=FATAL_ERROR,message=cvc-complex-type.2.4.a: Invalid content was found starting with element 'ItemServiceRef'. One of '{EntityRef}' is expected.,locator=[url=null,line=-1,column=-1,node=null,object=com.intuit.sb.datasync.writeback.qbxml.schema.ItemServiceRef@3409f69b,field=null]]". I have no idea what ItemServiceRef is. Here is the XML that I am sending:

<?xml version="1.0" encoding="utf-8"?>
<Add xmlns="http://www.intuit.com/sb/cdm/v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" RequestId="126fcdcda65a4a15ab422a69a2f021b1" xsi:schemaLocation="http://www.intuit.com/sb/cdm/V2./RestDataFilter.xsd ">
   <OfferingId>ipp</OfferingId>
   <TimeActivity>
      <TxnDate>2013-07-22</TxnDate>
      <NameOf>Employee</NameOf>
      <Employee>
        <EmployeeId idDomain="NG">88025</EmployeeId>
      </Employee>
      <CustomerId idDomain="NG">1212626</CustomerId>
      <ItemId idDomain="QB">1</ItemId>
      <PayItemId idDomain="QB">10</PayItemId>
      <BillableStatus>Billable</BillableStatus>
      <Taxable>false</Taxable>
      <HourlyRate>10.0</HourlyRate>
      <Hours>1</Hours>
      <Minutes>30</Minutes>
      <Description>Some description</Description>
   </TimeActivity>
</Add>

IF I change my xml to this, then it all works fine:

<?xml version="1.0" encoding="utf-8"?>
<Add xmlns="http://www.intuit.com/sb/cdm/v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" RequestId="126fcdcda65a4a15ab422a69a2f021b1" xsi:schemaLocation="http://www.intuit.com/sb/cdm/V2./RestDataFilter.xsd ">
   <OfferingId>ipp</OfferingId>
      <TimeActivity>
      <TxnDate>2013-07-22</TxnDate>
      <NameOf>Employee</NameOf>
      <Employee>
        <EmployeeId idDomain="QB">17</EmployeeId>
      </Employee>
      <CustomerId idDomain="QB">15</CustomerId>
      <ItemId idDomain="QB">1</ItemId>
      <PayItemId idDomain="QB">10</PayItemId>
      <BillableStatus>Billable</BillableStatus>
      <Taxable>false</Taxable>
      <HourlyRate>10.0</HourlyRate>
      <Hours>1</Hours>
      <Minutes>30</Minutes>
      <Description>Tutoring for Algebra</Description>
   </TimeActivity>
</Add>

All I did was to change my IDs to use the QB domain Id instead of the NG domain Id. The only problem I have with this is that when I create a new object through the API, Intuit only returns me NG domain Id (because it hasn't yet created the QB domain Id). So 1, the only way I have to get the QB Id is to make what should be an unnecessary re-query on an object that I already have the NG Id for. And 2, if I need to add a TimeActivity for a customer/employee/vendor that hasn't synced yet... I just can't?

Upvotes: 1

Views: 202

Answers (2)

Manas Mukherjee
Manas Mukherjee

Reputation: 5340

This is a bug in TimeActivity V2 API. Ideally we don't need to sync and re-query the customer entity just to get the QB id. A bug ticket has been raised. I will update here when it is fixed.

Upvotes: 3

Rob Wormald
Rob Wormald

Reputation: 96

I've always had strange issues with PayItems when creating TimeActivity.

The PayItemRef i think is referring to the PayItemName - I ended up actually having to include the element in addition to the PayItemId. This only sticks out to me because it caused a real problem in that I had to refactor a bunch of stuff to fetch the String PayItemName as well as the ID (which I had cached locally).

Not sure if it's exactly your issue, but might be relevant. The only other gotcha I found was that I had an '&' character in one of my PayItemNames - "I&E Engineering" and it caused all sorts of weird silent errors with sync.

As far as question 2, that may be the case. It may have to do with the fact inside QB there used to be the TimeTracker application, which read Jobs and presented a clock-type interface.

I once found a dev forum post relevant to this that helped me crack it, but apparently all of those posts are gone after Intuit's dev portal re-org.

Upvotes: 1

Related Questions