Search code examples
intuit-partner-platformquickbooks-online

IPP QBO UK v3 - Trouble adding Journal Entry with EntityId


Intuit Partner Platform - API v3 QBO United Kingdom.

I am properly setting the entity to an existing customer but the journal entry won't save. Line 2 I am using the Debtor account and setting the EntityId to a valid customer.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<outgoing><?xml version="1.0" encoding="UTF-8"?>
  <JournalEntry xmlns:ns2="http://www.intuit.com/sb/cdm/qbo" xmlns="http://schema.intuit.com/finance/v3">
    <TxnDate>2014-03-05</TxnDate>
    <PrivateNote>Invoice</PrivateNote>
    <DocNumber>102</DocNumber>
    <Adjustment>false</Adjustment>
    <Line>
      <Desc>Credit Sales</Desc>
      <Amount>150</Amount>
      <DetailType>JournalEntryLineDetail</DetailType>
      <JournalEntryLineDetail>
        <PostingType>Credit</PostingType>
        <AccountRef>1</AccountRef>
        <ClassRef></ClassRef>
        <DepartmentRef></DepartmentRef>
        <BillableStatus></BillableStatus>
      </JournalEntryLineDetail>
    </Line>
    <Line>
      <Desc>Debit Accounts Receivable</Desc>
      <Amount>150.00</Amount>
      <DetailType>JournalEntryLineDetail</DetailType>
      <JournalEntryLineDetail>
        <PostingType>Debit</PostingType>
        <AccountRef>52</AccountRef>
        <ClassRef></ClassRef>
        <DepartmentRef></DepartmentRef>
        <BillableStatus></BillableStatus>
        <EntityRef>
          <EntityRef>21</EntityRef>
          <Type>Customer</Type>
        </EntityRef>
      </JournalEntryLineDetail>
    </Line>
  </JournalEntry>
</outgoing>
<returns><?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  <IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2014-03-13T09:22:10.585-07:00">
    <Fault type="ValidationFault">
      <Error code="6000" element="">
        <Message>A business validation error has occurred while processing your request</Message>
        <Detail>Business Validation Error: When you use Debtors, you must choose a customer in the Name field.</Detail>
      </Error>
    </Fault>
  </IntuitResponse>
</returns>

Solution

  • Can you share the response XML for this issue. ( If you're using devkit, then please set the logger in DEBUG mode, to get the raw request and response XMLs)

    PFB one working JE response.

    <JournalEntry domain="QBO" sparse="false">
        <Id>6</Id>
        <SyncToken>0</SyncToken>
        <MetaData>
            <CreateTime>2014-03-10T21:10:17-07:00</CreateTime>
            <LastUpdatedTime>2014-03-10T21:10:17-07:00</LastUpdatedTime>
        </MetaData>
        <DocNumber>1</DocNumber>
        <TxnDate>2014-03-11</TxnDate>
        <CurrencyRef name="United States Dollar">USD</CurrencyRef>
        <Line>
            <Id>0</Id>
            <Description>Debit</Description>
            <Amount>100.00</Amount>
            <DetailType>JournalEntryLineDetail</DetailType>
            <JournalEntryLineDetail>
                <PostingType>Debit</PostingType>
                <Entity>
                    <Type>Customer</Type>
                    <EntityRef name="Customer123">2</EntityRef>
                </Entity>
                <AccountRef name="Accounts Receivable (A/R)">48</AccountRef>
                <ClassRef name="CLASS-1">3000000000000199718</ClassRef>
            </JournalEntryLineDetail>
        </Line>
        <Line>
            <Id>1</Id>
            <Description>Credit</Description>
            <Amount>100.00</Amount>
            <DetailType>JournalEntryLineDetail</DetailType>
            <JournalEntryLineDetail>
                <PostingType>Credit</PostingType>
                <AccountRef name="Sales">1</AccountRef>
            </JournalEntryLineDetail>
        </Line>
        <Adjustment>false</Adjustment>
    </JournalEntry>
    

    QBO UI( US company )

    enter image description here Thanks

    Instead of

    <EntityRef>
        <EntityRef>21</EntityRef>
        <Type>Customer</Type>
    </EntityRef>
    

    Please try (as you got from the response)

    <Entity>
        <Type>Customer</Type>
        <EntityRef name="Right Way Cleaners">21</EntityRef>
    </Entity>
    

    You had used EntityRef twice in the composite tag.