Author Topic: Linking a Sales Order to an Invoice  (Read 6850 times)

mvoogt

  • Member
  • *
  • Posts: 12
    • All Valley Hose & Industrial Supply
Linking a Sales Order to an Invoice
« on: June 28, 2009, 11:27:51 PM »
I create all of my Sales Orders in FMP and them push them to QB. I then pull the TxnID back to FMP on that sales order because I immediately want to invoice it that Sales Order.

The problem that I am having is connecting the Sales Order to the Invoice I want to make. I am trying to create an Invoice in FMP and use the LinkToTxnID request however I am just getting errors back and cannot seem to link the two.

Please Help!

Melinda DePalma

  • Member
  • *
  • Posts: 179
    • Productive Computing
Re: Linking a Sales Order to an Invoice
« Reply #1 on: June 30, 2009, 09:59:43 AM »
In order to better answer can you please let me know what exact errors you are receiving and provide a sample of your script?

mvoogt

  • Member
  • *
  • Posts: 12
    • All Valley Hose & Industrial Supply
Re: Linking a Sales Order to an Invoice
« Reply #2 on: June 30, 2009, 10:52:18 AM »
I have attached 2 screen shots to this post of my sample scripts.

The way that I initially made this script was to just push over an invoice with line items. It works fine when I do just that. However when I add the step "LinkToTxnID" it no longer works. I think I may be using that request wrong. I copied this script initially out of the PCQB demo file however since in the demo file the "LinkToTxnID" is not used, I am not too familiar with it.

I tried to refer to the QB SDK programer's guide (where it does have a section on using the LinkToTxnID request) however because it doesn't reference the PCQB plugin directly I found it hard to understand how to use the LinkToTxnID request correctly.

The Screen Shots

The first one is a script trying to just push over an invoice (with no line items) and using the LinkToTxnID.... hoping that it would pull the Line Items from the  QuickBooks ID it was linking to. However in the gResult field I just get !!ERROR!!

The second example I duplicated the sales order in FMP and made it an "invoice". Then I tried to push over that entire invoice (with the Line Items) and use the LinkToTxnID hoping it would relate the line items back to that original sales order. However in the gResult field I also just get !!ERROR!!

Finally, you asked what errors I am getting however the only thing that shows up in the gResults field is "!!ERROR!!" I don't get a number or anything.

Thank you so much for your time! Please let me know if you need more details or if my explanations are confusing.

-Matt

Melinda DePalma

  • Member
  • *
  • Posts: 179
    • Productive Computing
Re: Linking a Sales Order to an Invoice
« Reply #3 on: June 30, 2009, 11:07:09 AM »
If you download the latest bundle and read the Developer's Guide then this should clarify most of your questions about how to use the OSR to develop your scripts using the plug-in, error capturing and how to create requests/responses. Basically anytime you receive an !!ERROR!! call the PCQB_SGetStatus function in order to obtain a full description of the error. The text returned by this function should help troubleshoot script or logic failures. What is the text returned by this function ?

Also here is a direct download link to the bundle which contains the latest Developer's Guide as we recommend you read this latest documentation twice before developing your scripts:
http://www.fmbooksconnector.com/downloads/FMBooksConnector.zip

Please let me know.

mvoogt

  • Member
  • *
  • Posts: 12
    • All Valley Hose & Industrial Supply
Re: Linking a Sales Order to an Invoice
« Reply #4 on: June 30, 2009, 03:13:55 PM »
I got the error code:

------------

CODE: -1000
SEVERITY: failed validation
MESSAGE: Error at LinkToTxnID
Reason:   Element 'LinkToTxnID' is unexpected according to content model of parent element 'InvoiceAdd'.
Expecting: ItemSalesTaxRef, Memo, CustomerMsgRef, IsToBePrinted, CustomerSalesTaxCodeRef, InvoiceLineAdd, InvoiceLineGroupAdd.

Field Value:   BD3A3-1246394246

------------

That field value is the QB ID of the Sales Order I am trying to connect to

Melinda DePalma

  • Member
  • *
  • Posts: 179
    • Productive Computing
Re: Linking a Sales Order to an Invoice
« Reply #5 on: June 30, 2009, 03:44:38 PM »
In your second screen shot above can you please disable the script steps starting with "Go to Record/Request" and ending with "End Loop". The run the script and tell me if you receive an error and the error description.

mvoogt

  • Member
  • *
  • Posts: 12
    • All Valley Hose & Industrial Supply
Re: Linking a Sales Order to an Invoice
« Reply #6 on: June 30, 2009, 03:56:46 PM »
I get this error:

CODE: -1000
SEVERITY: failed validation
MESSAGE: Error at LinkToTxnID
Reason:   Element 'LinkToTxnID' is unexpected according to content model of parent element 'InvoiceAdd'.
Expecting: ItemSalesTaxRef, Memo, CustomerMsgRef, IsToBePrinted, CustomerSalesTaxCodeRef, InvoiceLineAdd, InvoiceLineGroupAdd.

Field Value:   BD3A3-1246394246

--------------------

Attached is a screen shot of the new script that gives me this error. Is it possible that I shouldn't be using the "PCQB_RqAddFieldWithValue" function for LinkToTxnID? Thanks for you help!

Melinda DePalma

  • Member
  • *
  • Posts: 179
    • Productive Computing
Re: Linking a Sales Order to an Invoice
« Reply #7 on: June 30, 2009, 05:14:54 PM »
It is possible to use the "PCQB_RqAddFieldWithValue" function for LinkToTxnID.

I believe that the issue could be that you are not specifing the ARAccountRef. I understand that this is not documented as a required field, but could you please add this field/element into your script and let me know your results.

mvoogt

  • Member
  • *
  • Posts: 12
    • All Valley Hose & Industrial Supply
Re: Linking a Sales Order to an Invoice
« Reply #8 on: June 30, 2009, 10:54:45 PM »
I get the same error. Attached is my new script.

bpmark

  • Member
  • *
  • Posts: 9
Re: Linking a Sales Order to an Invoice
« Reply #9 on: October 11, 2009, 07:49:55 AM »
I believe your answer lies in the order of your lines, and the attempt to pass unneeded info. From the top of your last screenshot, including comments, delete lines 9-13 and 15. As you're linking to existing data in a QuickBooks SalesOrder, there's no need to pass the details

Your entire setup, prepared to Begin Session and Execute should be like this (This ignores your navigation and the "Safety End"):

1) Set Variable [ $QB_Result; Value:PCQB_RqNew("InvoiceAdd" ; "" )
2) Set Variable [ $QB_Result; Value:PCQB_RqAddFieldWithValue( "CustomerRef::ListID" ; YourStoredCustomerListID ) )
3) Set Variable [ $QB_Result; Value:PCQB_RqAddFieldWithValue( "LinkToTxnID" ; YourStoredSOTxnID )

Begin, Execute and End the session with Quickbooks, with your desired error trapping and return info.

Hope this helps your breakthrough, the plug in and OSR are great together, ONCE you understand them.

Mark D Kerr