Productive Computing, Inc. Support Forum

Plug-ins => FM Books Connector => Topic started by: longterm on May 16, 2014, 12:43:24 PM

Title: Pushing invoice for customer already in QB
Post by: longterm on May 16, 2014, 12:43:24 PM
My client will be pushing lots of invoices for the same customers; when I try to do this, I get an error message because the customer already exists in QuickBooks.

I tried taking out the error-check, but clearly that's not the right thing to do.

How do I make sure that, when they push an invoice for a repeat customer, it goes through?

What I've done is to run the script to add a customer each time they push an invoice; should I not do that?

Thanks,

Bob Patin
Longterm Solutions
bob@longtermsolutions.com
615-333-6858
FileMaker 9, 10, 11 & 12 Certified Developer
http://www.longtermsolutions.com
-
iChat: bobpatin@me.com
Twitter: bobpatin

FileMaker Consulting
FileMaker Hosting for all versions of FileMaker
PHP Full email services Free DNS hosting Colocation Consulting

Title: Re: Pushing invoice for customer already in QB
Post by: Geoffrey Gerhard on May 16, 2014, 02:20:24 PM
Last question first: You should not do that.

Creating a bulletproof integration of FileMaker and QuickBooks is complex. Ideally, you'll store the ListID value that is returned in the CustomerAddResponse that came back from your CustomerAdd Request. You'd then pass it as the value in the argument: PCQB_RqAddFieldWithValue( "CustomerRef::ListID" ; Value ; "" ). It'll be run as you are constructing your InvoiceAdd Request.

HTH!

Geoffrey Gerhard
Creative Solutions Incorporated
14000 Creekside Drive
Matthews, NC  28105
704) 814-6852
Title: Re: Pushing invoice for customer already in QB
Post by: longterm on May 16, 2014, 02:36:14 PM
Thanks, I'll give that a shot...


Bob Patin
Longterm Solutions
bob@longtermsolutions.com
615-333-6858
FileMaker 9, 10, 11 & 12 Certified Developer
http://www.longtermsolutions.com
-
iChat: bobpatin@me.com
Twitter: bobpatin

FileMaker Consulting
FileMaker Hosting for all versions of FileMaker
PHP Full email services Free DNS hosting Colocation Consulting

Title: Re: Pushing invoice for customer already in QB
Post by: longterm on May 21, 2014, 02:03:21 PM
Well, I tried adding this line when creating a new invoice, where the customer is already added and I have the listID in the variable $QBListID:

PCQB_RqAddFieldWithValue( "CustomerRef::ListID" ; $QBListID )

but I get an error everytime.

I can't seem to find the proper command to set the ListID into an invoice; can someone help?

Thanks,

Bob Patin
Longterm Solutions
bob@longtermsolutions.com
615-333-6858
FileMaker 9, 10, 11 & 12 Certified Developer
http://www.longtermsolutions.com
-
iChat: bobpatin@me.com
Twitter: bobpatin

FileMaker Consulting
FileMaker Hosting for all versions of FileMaker
PHP Full email services Free DNS hosting Colocation Consulting

Title: Re: Pushing invoice for customer already in QB
Post by: longterm on May 22, 2014, 07:05:58 AM
Last question first: You should not do that.

Creating a bulletproof integration of FileMaker and QuickBooks is complex. Ideally, you'll store the ListID value that is returned in the CustomerAddResponse that came back from your CustomerAdd Request. You'd then pass it as the value in the argument: PCQB_RqAddFieldWithValue( "CustomerRef::ListID" ; Value ; "" ). It'll be run as you are constructing your InvoiceAdd Request.


Geoffrey,

I tried this

PCQB_RqAddFieldWithValue( "CustomerRef::ListID" ; $QBListID )

but looking at your example, you have 3 params; should I instead use this:

PCQB_RqAddFieldWithValue( "CustomerRef::ListID" ; $QBListID ; "" )

?

Thanks,

Bob Patin
Longterm Solutions
bob@longtermsolutions.com
615-333-6858
FileMaker 9, 10, 11 & 12 Certified Developer
http://www.longtermsolutions.com
-
iChat: bobpatin@me.com
Twitter: bobpatin

FileMaker Consulting
FileMaker Hosting for all versions of FileMaker
PHP Full email services Free DNS hosting Colocation Consulting

Title: Re: Pushing invoice for customer already in QB
Post by: Geoffrey Gerhard on May 22, 2014, 09:15:31 AM
The last parameter is truly optional, so omitting the second semi-colon and quotes is the same as including them.

Use the PCQB_SGetStatus to find out what error you're getting. I'm guessing that it's not a problem setting the CustomerRef::ListID, unless you're adding that element outside the proper sequence. It's really ironic that the sequence matters for non-repeating elements, given that a Request is entirely XML, but you'll get an error if your request contains an element that's preceded by any element that follows it. The OSR is really helpful when assembling the functions that build your Request.

HTH!

Geoffrey Gerhard
Creative Solutions Incorporated
14000 Creekside Drive
Matthews, NC  28105
704) 814-6852
Title: Re: Pushing invoice for customer already in QB
Post by: longterm on May 22, 2014, 09:16:47 AM
The last parameter is truly optional, so omitting the second semi-colon and quotes is the same as including them.

Use the PCQB_SGetStatus to find out what error you're getting. I'm guessing that it's not a problem setting the CustomerRef::ListID, unless you're adding that element outside the proper sequence. It's really ironic that the sequence matters for non-repeating elements, given that a Request is entirely XML, but you'll get an error if your request contains an element that's preceded by any element that follows it. The OSR is really helpful when assembling the functions that build your Request.

So I suppose I have to figure out how to use the OSR then... :)

I think you're right that it's out of sequence; is the OSR the only way to determine where the ListID is?
Title: Re: Pushing invoice for customer already in QB
Post by: longterm on May 22, 2014, 11:28:21 AM
Use the PCQB_SGetStatus to find out what error you're getting.

I'm getting this; my order seems to follow the OSR, but there are multiple ListIDs in the OSR list for adding an invoice.

When I use the following code:

PCQB_RqAddFieldWithValue( "ListID" ; $QBListID )

I get this error:

CODE: -1000
SEVERITY: failed validation
MESSAGE: Error at ListID
Reason:   Element 'ListID' is unexpected according to content model of parent element 'InvoiceAdd'.
Expecting: BillAddress, ShipAddress, IsPending, IsFinanceCharge, PONumber, TermsRef, DueDate, SalesRepRef, FOB, ShipDate, ShipMethodRef....

So here are the fields I'm trying to write, in this order in my script:

ListID
PONumber (which I leave blank)
DueDate
ShipDate
Memo

That's all I'm trying to write to the invoice, before I add the lineitems.

How do I get that ListID to write properly? I did manage to retrieve the ListID when I create the customer in QB, and store it in the customer record in FileMaker; I also added an IF so that if the customer's ListID field is empty (meaning he hasn't been added to QB), then it runs the script to create that customer in QB before trying to create the invoice.

Thanks for your help, I really appreciate it.

Bob Patin
Longterm Solutions
bob@longtermsolutions.com
615-333-6858
FileMaker 9, 10, 11 & 12 Certified Developer
http://www.longtermsolutions.com
Title: Re: Pushing invoice for customer already in QB
Post by: Geoffrey Gerhard on May 22, 2014, 12:18:40 PM
CustomerRef::ListID is the first element in an InvoiceAdd Request. Is there any chance you're adding that value twice?

Evaluate the PCQB_SGetXML( "Request" ; "" ) function after it fails and post the result here. The raw XML will tell the tale....

Geoffrey Gerhard
Creative Solutions Incorporated
14000 Creekside Drive
Matthews, NC  28105
704) 814-6852
Title: Re: Pushing invoice for customer already in QB
Post by: longterm on May 22, 2014, 01:05:42 PM
Geoffrey,

All I get is !!ERROR!!

Hmm... :)
Title: Re: Pushing invoice for customer already in QB
Post by: longterm on May 22, 2014, 01:20:35 PM
CustomerRef::ListID is the first element in an InvoiceAdd Request. Is there any chance you're adding that value twice?

Evaluate the PCQB_SGetXML( "Request" ; "" ) function after it fails and post the result here. The raw XML will tell the tale....


Got it! I had 2 commands in there, just like you thought; when I scrolled up in the script I spotted it (this is a sample script that I'd heavily modified...).

At any rate, all good; I owe you one. If you need any hosting or FileMaker consulting, please give me a buzz and I'll gladly return your kindness.

Bob Patin
Longterm Solutions
bob@longtermsolutions.com
615-333-6858
FileMaker 9, 10, 11 & 12 Certified Developer
http://www.longtermsolutions.com
-
iChat: bobpatin@me.com
Twitter: bobpatin

FileMaker Consulting
FileMaker Hosting for all versions of FileMaker
PHP Full email services Free DNS hosting Colocation Consulting