Jump to content

Recommended Posts

I'm trying to add a sales rep to an invoice when I push an invoice to QB Desktop, but it keeps failing validation (error -1000) when I try to add the Sales Rep's ListID, the Sales Rep's FullName, SalesRepEntityRef value, etc. to the field "SalesRepRef". To be clear, I've tried all the different values to see if any work. I'm not trying to set them all at the same time. 🙃

Any ideas if I'm using incorrect values, i.e., values it's not expecting, or I'm trying to set the wrong QB field, or is this something that's just not possible?

Thanks in advance!

-Kent

Edited by Kent Searight
clarification
Link to post
Share on other sites

What's the full text of the error message? Error -1000 is pretty general, I think. (Your InvoiceAdd works without the SalesRepRef elements, right?)

Geoffrey Gerhard
Creative Solutions Incorporated
14000 Creekside Drive
Matthews, NC 28105
704.814.6852

Link to post
Share on other sites
Posted (edited)
2 minutes ago, Geoffrey Gerhard said:

What's the full text of the error message? Error -1000 is pretty general, I think. (Your InvoiceAdd works without the SalesRepRef elements, right?)

Geoffrey Gerhard
Creative Solutions Incorporated
14000 Creekside Drive
Matthews, NC 28105
704.814.6852

Severity: failed validation

 

Yeah, I can push and query invoices with no problem.

Edited by Kent Searight
Link to post
Share on other sites

PCQB_SGetStatus function returns a description of what caused the failure in its "MESSAGE:" segment. Is there anything there that provides more details?

Geoffrey Gerhard
Creative Solutions Incorporated

14000 Creekside Drive
Matthews, NC 28105
704.814.6852

Link to post
Share on other sites

Sorry, I only pasted the end of the message. This is what I get back:

"Error at SalesRepRef" (after calling the plugin function PCQB_RqExecute) Severity: failed validation

Link to post
Share on other sites

That's odd. Failed validation used to return something that looked like this...

CODE: -1000
SEVERITY: failed validation
MESSAGE: Error at OpenBalance
Reason:    '!!ERROR!! Amount type argument out of range 110748721.32' violates pattern constraint of '([+\-]?[0-9]{1,13}(\.[0-9]{2})?)?'.
The element 'OpenBalance' with value '!!ERROR!! Amount type argument out of range 110748721.32' failed to parse.

Field Value:    !!ERROR!! Amount type argument out of range 110748721.32

...in response to the SGetStatus call.

Before you call PCQB_RqExecute, pause your script and use the data viewer to capture the result of PCQB_SGetXML( "Request" ; "" ) and post it here. Perhaps that will show enough detail and context to identify the problem.

Geoffrey Gerhard
Creative Solutions Incorporated

14000 Creekside Drive
Matthews, NC 28105
704.814.6852

Link to post
Share on other sites
2 hours ago, Geoffrey Gerhard said:

That's odd. Failed validation used to return something that looked like this...

CODE: -1000
SEVERITY: failed validation
MESSAGE: Error at OpenBalance
Reason:    '!!ERROR!! Amount type argument out of range 110748721.32' violates pattern constraint of '([+\-]?[0-9]{1,13}(\.[0-9]{2})?)?'.
The element 'OpenBalance' with value '!!ERROR!! Amount type argument out of range 110748721.32' failed to parse.

Field Value:    !!ERROR!! Amount type argument out of range 110748721.32

...in response to the SGetStatus call.

Before you call PCQB_RqExecute, pause your script and use the data viewer to capture the result of PCQB_SGetXML( "Request" ; "" ) and post it here. Perhaps that will show enough detail and context to identify the problem.

Geoffrey Gerhard
Creative Solutions Incorporated

14000 Creekside Drive
Matthews, NC 28105
704.814.6852

You're right. I was using the SGetStatus call after I'd get an error but then I was parsing out only what I thought I needed (wrongly, as it turns out). Here's the full response.

CODE: -1000
SEVERITY: failed validation
MESSAGE: Error at SalesRepRef
Reason:    Text is not allowed in the context of element 'SalesRepRef' according to DTD/Schema.
Expecting: ListID, FullName.

Field Value:    80000001-1586535406

---

Then I did as you suggested and got the result of PCQB_SGetXML( "Request" ; "" ). That resulted in all the following:

<?xml version="1.0"?>
<QBXML>
    <QBXMLMsgsRs>
        <InvoiceAddRs statusCode="0" statusSeverity="Info" statusMessage="Status OK">
            <InvoiceRet>
                <TxnID>8E0-1616611379</TxnID>
                <TimeCreated>2021-03-24T11:42:59-08:00</TimeCreated>
                <TimeModified>2021-03-24T11:42:59-08:00</TimeModified>
                <EditSequence>1616611379</EditSequence>
                <TxnNumber>418</TxnNumber>
                <CustomerRef>
                    <ListID>8000002B-1583010213</ListID>
                    <FullName>Stark St. Nursery</FullName>
                </CustomerRef>
                <ARAccountRef>
                    <ListID>8000001E-1582670087</ListID>
                    <FullName>Accounts Receivable</FullName>
                </ARAccountRef>
                <TemplateRef>
                    <ListID>80000001-1582487741</ListID>
                    <FullName>Intuit Product Invoice</FullName>
                </TemplateRef>
                <TxnDate>2021-03-24</TxnDate>
                <RefNumber>20754</RefNumber>
                <BillAddress>
                    <Addr1>5050 SE Stark Street</Addr1>
                    <City>Portland</City>
                    <State>OR</State>
                    <PostalCode>97215</PostalCode>
                </BillAddress>
                <BillAddressBlock>
                    <Addr1>5050 SE Stark Street</Addr1>
                    <Addr2>Portland, OR 97215</Addr2>
                </BillAddressBlock>
                <ShipAddress>
                    <Addr1>5050 SE Stark Street</Addr1>
                    <City>Portland</City>
                    <State>OR</State>
                    <PostalCode>97215</PostalCode>
                </ShipAddress>
                <ShipAddressBlock>
                    <Addr1>5050 SE Stark Street</Addr1>
                    <Addr2>Portland, OR 97215</Addr2>
                </ShipAddressBlock>
                <IsPending>false</IsPending>
                <IsFinanceCharge>false</IsFinanceCharge>
                <PONumber>4450112</PONumber>
                <TermsRef>
                    <ListID>80000002-1582487751</ListID>
                    <FullName>2% 10 Net 30</FullName>
                </TermsRef>
                <DueDate>2021-04-23</DueDate>
                <ShipDate>2021-03-24</ShipDate>
                <ShipMethodRef>
                    <ListID>80000005-1586535335</ListID>
                    <FullName>Delivery</FullName>
                </ShipMethodRef>
                <Subtotal>1747.42</Subtotal>
                <SalesTaxPercentage>0.00</SalesTaxPercentage>
                <SalesTaxTotal>0.00</SalesTaxTotal>
                <AppliedAmount>0.00</AppliedAmount>
                <BalanceRemaining>1747.42</BalanceRemaining>
                <IsPaid>false</IsPaid>
                <IsToBePrinted>true</IsToBePrinted>
                <IsToBeEmailed>false</IsToBeEmailed>
                <SuggestedDiscountAmount>34.95</SuggestedDiscountAmount>
                <SuggestedDiscountDate>2021-04-03</SuggestedDiscountDate>
                <InvoiceLineRet>
                    <TxnLineID>8E2-1616611379</TxnLineID>
                    <ItemRef>
                        <ListID>80000048-1583688064</ListID>
                        <FullName>Color:4.25" Anemone</FullName>
                    </ItemRef>
                    <Desc>4.25" Anemone, UPC: 560333098761, 10 units/product, $2.55/unit</Desc>
                    <Quantity>40</Quantity>
                    <Rate>25.50</Rate>
                    <Amount>1020.00</Amount>
                    <SalesTaxCodeRef>
                        <ListID>80000002-1582487741</ListID>
                        <FullName>Non</FullName>
                    </SalesTaxCodeRef>
                </InvoiceLineRet>
                <InvoiceLineRet>
                    <TxnLineID>8E3-1616611379</TxnLineID>
                    <ItemRef>
                        <ListID>80000017-1583093374</ListID>
                        <FullName>Organic Herb:Organic 4" Herbs Rnd plastic</FullName>
                    </ItemRef>
                    <Desc>Organic 4" Herbs Rnd plastic, UPC: 342941800017, 10 units/product, $1.68/unit</Desc>
                    <Quantity>33</Quantity>
                    <Rate>16.80</Rate>
                    <Amount>554.40</Amount>
                    <SalesTaxCodeRef>
                        <ListID>80000002-1582487741</ListID>
                        <FullName>Non</FullName>
                    </SalesTaxCodeRef>
                </InvoiceLineRet>
                <InvoiceLineRet>
                    <TxnLineID>8E4-1616611379</TxnLineID>
                    <ItemRef>
                        <ListID>8000001A-1583093527</ListID>
                        <FullName>Organic Veg.:Org 606 Veg Jumbo</FullName>
                    </ItemRef>
                    <Desc>Organic 606 Vegetables Jumbo Tray Pack, UPC: 342941800020, 6 units/product, $2.09/unit</Desc>
                    <Quantity>13</Quantity>
                    <Rate>12.54</Rate>
                    <Amount>163.02</Amount>
                    <SalesTaxCodeRef>
                        <ListID>80000002-1582487741</ListID>
                        <FullName>Non</FullName>
                    </SalesTaxCodeRef>
                </InvoiceLineRet>
                <InvoiceLineRet>
                    <TxnLineID>8E5-1616611379</TxnLineID>
                    <ItemRef>
                        <ListID>80000049-1593535470</ListID>
                        <FullName>Shipping</FullName>
                    </ItemRef>
                    <Desc>Shipping &amp; Handling</Desc>
                    <Quantity>1</Quantity>
                    <Rate>10.00</Rate>
                    <Amount>10.00</Amount>
                    <SalesTaxCodeRef>
                        <ListID>80000002-1582487741</ListID>
                        <FullName>Non</FullName>
                    </SalesTaxCodeRef>
                </InvoiceLineRet>
            </InvoiceRet>
        </InvoiceAddRs>
    </QBXMLMsgsRs>
</QBXML>

 

---

Since there is no SalesRepRef element in the XML, does that mean it's not possible for the AddInvoice request to add a sales rep to an invoice?

BTW, the reason I'm trying to do this is to assign the sales rep of the order in FileMaker to the invoice in QB. In the Field Value portion of SGetStatus call's response you see a ListID. This is the ListID of the person who's assigned to the customer in Quickbooks, but there are times when the sales rep of an order in FileMaker is not the sales rep assigned in QB. I'm trying to override the default value that QB uses when I do the push. From what I'm seeing now, I'm thinking that it might not be possible.

What's your take on it from everything you know now?

Thanks a bunch for your help, BTW, it's really appreciated!

-Kent

Link to post
Share on other sites

What you've quoted is a Response—note the <InvoiceAddRs> and </InvoiceRet> tags. I wouldn't expect that result from a PCQB_SGetXML( "Request" ; "" ) call.

There should be no issue identifying a SalesRep in an InvoiceAddRq. You'd normally pass the value in a PCQB_RqAddFieldWithValue( "SalesRepRef:ListID" ; "..." ; "" ) or PCQB_RqAddFieldWithValue( "SalesRepRef:FullName" ; "Initials" ; "" ) call.

I'm wondering if there's an issue with the ambiguity between the SalesRep's ListID and SalesRepEntityRef:ListID. You want to pass the former, not the latter. If you're passing SalesRepRef:FullName, note that the value is a max of 5 characters in length. You can find the value in the QB UI or in the SalesRepQueryRs—it's value in the list element "Initials". (Sales rep has no FullName element except inside the SalesRepEntity node, which ties it to an Employee or Other Name record.)

HTH!

Geoffrey Gerhard
Creative Solutions Incorporated
14000 Creekside Drive
Matthews, NC 28105
704.814.6852

Edited by Geoffrey Gerhard
  • Like 1
Link to post
Share on other sites

Got it to work exactly as needed. I'd forgotten to append "SalesRepRef" with "::ListID" in PCQB_RqAddFieldWithValue. (Duh 🤪)

On the plus side I learned some valuable stuff from the PCQB_SGetXML call. I'd never used it before. That's a nice addition to the developing/debugging toolbox.

Thanks again!

-Kent

Link to post
Share on other sites

Glad you got it working. Regarding PCQB_SGetXML: It's really handy, especially when an integration starts getting nuanced and/or complex.

Geoffrey Gerhard
Creative Solutions Incorporated

14000 Creekside Drive
Matthews, NC 28105
704.814.6852

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.