Plug-ins > FM Books Connector Online

Exporting invoice with DescriptionOnly line

(1/2) > >>

pjreagan:
I'm trying to export an invoice that has a DetailOnly line but an error is returned when the line's detail record creation is attempted.  Here's my code...

PCQO_RqNew("create"; "Invoice")
PCQO_RqAddFieldWithValue("TxnDate"; "2014-09-09")
PCQO_RqAddFieldWithValue("PrivateNote"; "From invoice #2")
PCQO_RqAddRelatedRecord("Line")
PCQO_RqAddFieldWithValue("Description"; "tested")
PCQO_RqAddFieldWithValue("Amount"; "1312.5")
PCQO_RqAddFieldWithValue("DetailType"; "SalesItemLineDetail")
PCQO_RqAddRelatedRecord("SalesItemLineDetail")
PCQO_RqAddFieldWithValue("ItemRef::Value"; "57")
PCQO_RqAddFieldWithValue("UnitPrice"; "125")
PCQO_RqAddFieldWithValue("Qty"; "10.5")
PCQO_RqAddFieldWithValue("TaxCodeRef::Value"; "TAX")
PCQO_RqAddFieldWithValue("ServiceDate"; "2014-09-09")
PCQO_RqCloseRelatedRecord
PCQO_RqCloseRelatedRecord
PCQO_RqAddRelatedRecord("Line")
PCQO_RqAddFieldWithValue("Description"; "Explanation lines are theoretically possible")
PCQO_RqAddFieldWithValue("DetailType"; "DescriptionOnly")
PCQO_RqAddRelatedRecord("DescriptionLineDetail")

At this point the following error is returned...
An error occurred while adding a related record
CODE: -507
SEVERITY: Error
MESSAGE: Invalid type of related record
SOURCE: PCQO_RqAddRelatedRecord

If I leave out the attempt to add a DescriptionLineDetail related record, the invoice exports but no DetailOnly line appears in the QBO invoice.

What am I doing wrong? 
Thanks in advance!

Jerel Malong:
Contrary to the example in the ESR for DescriptionOnly, it should be similar to what you've done for SalesItemLineDetail. When specifying the DetailType, and specific detail information must be specified, the related record name has to be the same as the detail type.

Try changing your last line from PCQO_RqAddRelatedRecord( "DescriptionLineDetail" ) to PCQO_RqAddRelatedRecord( "DescriptionOnly" )

pjreagan:
Thanks for the quick reply Jerel!

But maybe I don't understand...  Here's my revised code for adding the DescriptionOnly line.  It's still throwing an error, even with the suggested change, when trying to add the related record...

...
PCQO_RqAddRelatedRecord("Line")
PCQO_RqAddFieldWithValue("Description"; "Explanation lines are possible")
PCQO_RqAddFieldWithValue("DetailType"; "DescriptionOnly")
PCQO_RqAddRelatedRecord("DescriptionOnly")    // ERROR IS THROWN ON THIS LINE
PCQO_RqAddFieldWithValue("TaxCodeRef::Value"; "NON")
PCQO_RqCloseRelatedRecord
PCQO_RqCloseRelatedRecord
...

The error...
An error occurred while adding a related record
CODE: -507
SEVERITY: Error
MESSAGE: Invalid type of related record
SOURCE: PCQO_RqAddRelatedRecord

Paul Dacanay:
There is a "mismatch" issue when mapping the related record name to the detail type, so this will be resolved in a future release update of the plug-in. No official date is in place as to when the update will be released, but our products development team is aware of the issue and will be addressing it.

For now, simply omit these 3 lines from your code:

PCQO_RqAddRelatedRecord("DescriptionOnly")    // ERROR IS THROWN ON THIS LINE
PCQO_RqAddFieldWithValue("TaxCodeRef::Value"; "NON")
PCQO_RqCloseRelatedRecord

So, your code should look like this:

...
PCQO_RqAddRelatedRecord("Line")
PCQO_RqAddFieldWithValue("Description"; "Explanation lines are possible")
PCQO_RqAddFieldWithValue("DetailType"; "DescriptionOnly")
PCQO_RqCloseRelatedRecord
...

pjreagan:
Thanks for the reply Paul, but I had already tried that approach (and just tried it again).  This doesn't work over here for some reason.  My code for this section is...

PCQO_RqAddRelatedRecord("Line")
PCQO_RqAddFieldWithValue("Description"; "Explanation lines are possible")
PCQO_RqAddFieldWithValue("DetailType"; "DescriptionOnly")
PCQO_RqCloseRelatedRecord

It exports with no error, but the invoice produced in QBO does not show the explanation line.  When I query QBO for this invoice, the resulting xml does not contain any indication that the DescriptionOnly line was created.

So that code works over there?  What I'm using looks exactly the same as what you suggested.  Am I still missing something?

Navigation

[0] Message Index

[#] Next page

Go to full version