Author Topic: Adding Invoice : RefNumber Issue Code: -1000 error  (Read 2803 times)

raweeus

  • Member
  • *
  • Posts: 4
Adding Invoice : RefNumber Issue Code: -1000 error
« on: December 28, 2012, 03:12:52 PM »
I try to add Invoice# from FM to QB but i got Code: -1000 error


I used the demo scrip and just add one line into it.
Set Variable [ $$Result; Value:PCQB_RqAddFieldWithValue( "RefNumber" ; Main::gPush_Invoice RefNumber) ]

without that line it works so what did i do wrong?

=========================================================================================

Set Variable [ $$Result ; Value:PCQB_RqNew("InvoiceAdd" ; "" ) ]
If [ IsEmpty(Main::gPush_Customer ListID) ]
Set Field [ Main::gResult ; "You cannot create an invoice unless you have a a List ID for the customer listed above. Add the
Customer by pressing the 'Add Customer' button above." ]
Halt Script
End If
If [ Count( Items::Name ) < 1 ]
Set Field [ Main::gResult ; "The plug-in failed to import Items from QuickBooks. Please ensure that Items exist in QuickBooks and
try to import again." ]
Halt Script
End If
Set Variable [ $$Result ; Value:PCQB_RqAddFieldWithValue( "CustomerRef::ListID" ; Main::gPush_Customer ListID ) ]
Set Variable [ $$Result ; Value:PCQB_RqAddFieldWithValue( "TxnDate"; Main::gPush_Invoice TxnDate) ]
Set Variable [ $$Result ; Value:PCQB_RqAddFieldWithValue( "PONumber"; Main::gPush_Invoice PONumber) ]
Set Variable [ $$Result ; Value:PCQB_RqAddFieldWithValue( "DueDate"; Main::gPush_Invoice DueDate) ]
Set Variable [ $$Result ; Value:PCQB_RqAddFieldWithValue( "ShipDate"; Main::gPush_Invoice ShipDate) ]
Set Variable [ $$Result; Value:PCQB_RqAddFieldWithValue( "RefNumber" ; Main::gPush_Invoice RefNumber) ]
If [ PatternCount( Main::gCountry ; "CA" ) <> 1 ]
QB_FMBook: -- Push to QuickBooks --: Push Invoice to QB
#QuickBooks Canadian does not currently support "ItemSalesTaxRef" (known bug)
Set Variable [ $$Result ; Value:PCQB_RqAddFieldWithValue( "ItemSalesTaxRef::FullName"; Main::gPush_Invoice
CustomerSalesTaxCodeRefFullName) ]
End If
Set Variable [ $$Result ; Value:PCQB_RqAddFieldWithValue( "Memo"; Main::gPush_Invoice Memo) ]
#Prep Line Items (Request)
Go to Field [ Inv LI Push::InvoiceLineItemNo ]
[ Select/perform ]
Go to Portal Row
[ Select; First ]
Loop
Set Variable [ $$Result ; Value:PCQB_RqAddRelatedRecord( "InvoiceLineAdd" ; "" ) ]
Set Variable [ $$Result ; Value:PCQB_RqAddFieldWithValue( "ItemRef::FullName" ; Inv LI Push::InvoiceLineItemNo ) ]
Set Variable [ $$Result ; Value:PCQB_RqAddFieldWithValue( "Desc" ; Inv LI Push::InvoiceLineDesc) ]
Set Variable [ $$Result ; Value:PCQB_RqAddFieldWithValue( "Quantity" ; Inv LI Push::InvoiceLineQuantity ) ]
Set Variable [ $$Result ; Value:PCQB_RqAddFieldWithValue( "Rate" ; Inv LI Push::InvoiceLineRate ) ]
If [ not IsEmpty ( Inv LI Push::InvoiceLineClassRefFullName ) ]
#Push class only if it's included in the FileMaker file.
Set Variable [ $$Result ; Value:PCQB_RqAddFieldWithValue( "ClassRef::FullName"; Inv LI Push::
InvoiceLineClassRefFullName ) ]

==========================================================================================

Geoffrey Gerhard

  • Guru
  • Member
  • ****
  • Posts: 468
Re: Adding Invoice : RefNumber Issue Code: -1000 error
« Reply #1 on: December 28, 2012, 04:00:19 PM »
Move the new line so it follows "Set Variable [ $$Result ; Value:PCQB_RqAddFieldWithValue( "TxnDate"; Main::gPush_Invoice TxnDate) ]".

Sequence matters, so sending a step in the wrong place will error every time. For future reference, executing PCQB_SGetStatus will tell you what went wrong, and the OSR ( http://developer.intuit.com/qbsdk-current/Common/newOSR/index.html ) will show you the sequence of elements it's expecting.

HTH!

Geoffrey Gerhard
Creative Solutions Incorporated
14000 Creekside Drive
Matthews, NC  28105
704) 814-6852

raweeus

  • Member
  • *
  • Posts: 4
Re: Adding Invoice : RefNumber Issue Code: -1000 error
« Reply #2 on: December 31, 2012, 08:59:36 AM »
Great!! It actually works. I had no idea that sequence is matters. Thank you

PaulMcPherson

  • Member
  • *
  • Posts: 2
Re: Adding Invoice : RefNumber Issue Code: -1000 error
« Reply #3 on: March 08, 2013, 06:49:36 AM »
Hi I am having the same problem trying to add SONumber or CustomField.  Does anyone know where should these line go???  Agian I am using the same script.
It would be great to have a list of all the correct order of the fields.
Thanks from a new member trying to get it to work..... ::)

Geoffrey Gerhard

  • Guru
  • Member
  • ****
  • Posts: 468
Re: Adding Invoice : RefNumber Issue Code: -1000 error
« Reply #4 on: March 08, 2013, 05:47:59 PM »
As far as the field sequence, you'll find it outlined on Intuit's On Screen Reference (OSR) at http://developer.intuit.com/qbsdk-current/Common/newOSR/index.html. I usually look at the XMLOps tab, which has useful information on what's required, what's optional, what may repeat, etc. Clicking most elements on the Request tab, however, will usually pop up some info about the element that you may find useful.

I'm not really clear on your other questions.

Custom Fields are a stumbling block for many developers. Custom Fields are referenced as DataExt and have three parts. The OwnerID value is 0, the DataExtName is the name of the Custom Field, the DataExtValue is the value you want to see in QB's Custom Field. Invoice Lines are one of the few places you can pass a CustomField value in an Add Request. If you're trying to populate a Custom Field at the Invoice level, you'll need to complete the Invoice Add Request and then make a DataExt Mod Request that includes the txnID of the Invoice you just added.

Is the SONumber a Custom Field? Or are you trying to link a QB Invoice to a QB SalesOrder?

Good Luck!

Geoffrey Gerhard
Creative Solutions Incorporated
14000 Creekside Drive
Matthews, NC  28105
704) 814-6852

PaulMcPherson

  • Member
  • *
  • Posts: 2
Re: Adding Invoice : RefNumber Issue Code: -1000 error
« Reply #5 on: March 09, 2013, 01:44:54 AM »
Hi Geoffrey,
Am am trying to add our internal job reference to the invoice, when we were importing via transaction pro we used the "other" field and that worked.
At this web page it seems to show all the invoice fields and I thought that "SONumber" may achieve what we require.  I have tried to use the link you suggested but cannot find the listing and order you suggest is there.

http://doc.qodbc.com/qodbc/20/tables/qbview_d_invoice1d6b.html?qbviewd_id=37

Hope that helps.  I am new to all of this.
Regards
Paul

Geoffrey Gerhard

  • Guru
  • Member
  • ****
  • Posts: 468
Re: Adding Invoice : RefNumber Issue Code: -1000 error
« Reply #6 on: March 11, 2013, 07:33:09 AM »
On the page I referenced there's a drop-down menu labeled "Select Message:" that has all of the possible targets for a Request via the QB API. You'll select "InvoiceAdd" to get the details you need.

I think you may have answered my question about SONumber--try passing the SONumber as the value of the "Other" element in your QB Request.

HTH!

Geoffrey Gerhard
Creative Solutions Incorporated
14000 Creekside Drive
Matthews, NC  28105
704) 814-6852