Productive Computing, Inc. Support Forum

Plug-ins => FM Books Connector => Topic started by: HG43TX on January 03, 2013, 08:11:36 PM

Title: Issue pushing invoice to quickbooks from filemaker
Post by: HG43TX on January 03, 2013, 08:11:36 PM
Hi,

I was able to successfully push a customer from filemaker to quickbooks.  However I am having trouble pushing an invoice to quickbooks.  I think the issue is at the PCQB_RqExecute - or something prior is making PCQB_RqExecute fail.  Attached is the script.  Any help would be much appreciated.

Set Variable [$INV; Value:Invoice::Invoice ID
Go to Related Record [From table:“Invoice”;Using layout: “Invoice_For QB print” (Invoice) ] #Setup
If [IsEmpty ( Customer::ListID )]
Show Custom Dialog [Title:"Customer must exist in quickbooks"; Default Button:“OK”, Commit:“Yes”; Button 2:“Cancel”, Commit:“No”] Go to Related Record[From table:“Invoice”;Using layout: “Invoice” (Invoice) ] [Show only related records]
Exit Script [ ] End If If [Invoice::QB Inv Ref <> ""]
Show Custom Dialog[Title:"Invoice already exported to QB"; Default Button:“OK”, Commit:“Yes”; Button 2:“Cancel”, Commit: “No”]
Go to Related Record [From table:“Invoice”;Using layout: “Invoice” (Invoice) ] [Show only related records]
Exit Script [ ]
End If #Registration process
 Perform Script [“Plug in Checker”]
Freeze Window #Close Session - This will end any session that may have been started and not properly ended.
Set Field[Invoice::ScriptErr; PCQB_EndSession] #Capture the QB List ID and Edit Sequence (Response)
Set Variable [$$Result; Value:PCQB_RqNew("InvoiceAdd" ; "" )]
If[$$Result <> "0"]
Show Custom Dialog [Title:"no new inv"; Default Button:“OK”, Commit:“Yes”; Button 2:“Cancel”, Commit:“No”]
 Go to Related Record [From table:“Invoice”;Using layout: “Invoice” (Invoice) ] [Show only related records]
End If
Set Variable[$$Result; Value:PCQB_RqAddFieldWithValue( "CustomerRef::ListID" ; Customer::ListID )]
Set Variable [$$Result; Value:PCQB_RqAddFieldWithValue( "TxnDate"; Invoice::Invoice Date)]
Set Variable [$$Result; Value:PCQB_RqAddFieldWithValue( "PONumber";Invoice::PO Ref)]
 Set Variable[$$Result; Value:PCQB_RqAddFieldWithValue( "DueDate"; Invoice::Due Date)]
Set Variable [$$Result; Value:PCQB_RqAddFieldWithValue( "ShipDate"; Invoice::Ship Date)] #Prep Line Items (Request)
Go to Portal Row [Select; First]
Loop
Exit Loop If[IsEmpty ( Invoice Details::Product ID )]
Set Variable [$$Result; Value:PCQB_RqAddRelatedRecord( "InvoiceLineAdd" ; "" )]
Set Variable [$$Result; Value:PCQB_RqAddFieldWithValue( "ItemRef::FullName" ; Invoice Details::Product ID )]
Set Variable[$$Result; Value:PCQB_RqAddFieldWithValue( "Desc" ;Invoice Details::Description)]
Set Variable [$$Result; Value:PCQB_RqAddFieldWithValue( "Quantity" ; Invoice Details::Total lbs)]
Set Variable [$$Result; Value:PCQB_RqAddFieldWithValue( "Rate" ;Invoice Details::Price per lb )]
Set Variable[$$Result; Value:PCQB_RqCloseRelatedRecord]
Go to Portal Row [Select; Next; Exit after last]
End Loop
Set Variable [$$Result; Value:PCQB_BeginSession("";"")
 If[$$Result <> "0"]
Show Custom Dialog [Title:"No Begin session"; Default Button:“OK”, Commit:“Yes”; Button 2:“Cancel”, Commit:“No”]
 Go to Related Record [From table:“Invoice”;Using layout: “Invoice” (Invoice) ] [Show only related records]
End If #Execute
Set Variable [$$Result; Value:PCQB_RqExecute( "" ; "" ; "" )] #Close Session
Set Variable[$$Result2; Value:PCQB_EndSession] #Capture the QB List ID (Response)
Set Variable [$$Result; Value:PCQB_RsOpenFirstRecord]
Set Field[Invoice::TxnID; PCQB_RsGetFirstFieldValue( "TxnID" )]
 Set Field [Invoice::QB Inv Ref; PCQB_RsGetFirstFieldValue( "RefNumber" )]
Commit Records/Requests [Skip data entry validation; No dialog]
Go to Related Record [From table:“Invoice”;Using layout: “Invoice” (Invoice) ] [Show only related records]



Thanks,

HG
Title: Re: Issue pushing invoice to quickbooks from filemaker
Post by: Geoffrey Gerhard on January 04, 2013, 06:56:27 AM
If you're using FileMaker Advanced, step through the script using the Script Debugger. After you execute the step...

Set Variable [$$Result; Value:PCQB_RqExecute( "" ; "" ; "" )] #Close Session

...open the Data Viewer, evaluate PCQB_SGetStatus, and post the result here if you still need help figuring out what went wrong. If you don't have FileMaker Advanced, you can add a Set Field step after the above step and set its value to PCQB_SGetStatus.


HTH!

Geoffrey Gerhard
Creative Solutions Incorporated
14000 Creekside Drive
Matthews, NC  28105
704) 814-6852
Title: Re: Issue pushing invoice to quickbooks from filemaker
Post by: HG43TX on January 13, 2013, 04:00:26 PM
Thanks - the issue was a mismatch on the product ID.