Author Topic: Post Payment Not Recognizing Invoice  (Read 3536 times)

jasonw75

  • Member
  • *
  • Posts: 4
Post Payment Not Recognizing Invoice
« on: February 08, 2012, 08:19:25 PM »
Hi,

I'm new to the forum, and to FMBooksConnector.  The problem I'm experiencing is that after successfully creating an invoice in QB, and subsequently populating the Invoice Transaction ID into the invoice in FM, posting a payment against that invoice is failing.  I've tried this with a few invoices, with the same result.

The error message is:
!!ERROR!!
CODE:  3120
SEVERITY:  Error
MESSAGE:  Object "A3DA-1328206053" specified in the request cannot be found.  QuickBooks error message: Invalid argument.  The specified record does not exist in the list.

The script content is:
Set Variable [ $$Result; Value:PCQB_EndSession]
If [$$Result <> 0]
   Set Field [Globals::gConnectionResult; $$Result]
        (display dialog)
   Exit Script [ ]
End If
Set Variable [$$Result; Value:PCQB_RqNew("ReceivePaymentAdd", "")]
Set Variable{$$Result; Value:PCQB_RqAddFieldWithValue("CustomerRef::ListID"; Txns_Client::QuickBooksListID)]
Set Variable{$$Result; Value:PCQB_RqAddFieldWithValue("TxnDate"; Txns::Date)]
If [not Patterncount(Txns::Paid Via; "Credit Card") and not IsEmpty(Txns::Check Number)]
   Set Variable [$$Result; Value:PCQB_RqAddFieldWithValue("RefNumber"; Txns::Check Number)]
Else
   Set Variable [$$Result; Value:PCQB_RqAddFieldWithValue("RefNumber"; "1")]
End If
Set Variable{$$Result; Value:PCQB_RqAddFieldWithValue("TotalAmount"; txns_Finance::Invoice Amount)]
Set Variable{$$Result; Value:PCQB_RqAddFieldWithValue("PaymentMethodRef::ListID"; Txns_Finance::Invoice TxnID)]
If [not IsEmpty(Txns::Memo)]
   Set Variable{$$Result; Value:PCQB_RqAddFieldWithValue("Memo"; Txns::Memo)]
Else
   Set Variable{$$Result; Value:PCQB_RqAddFieldWithValue("Memo"; "textnote")]
End If
Set Variable{$$Result; Value:PCQB_RqAddRelatedRecord("AppliedToTxnAdd")]
Set Variable{$$Result; Value:PCQB_RqAddFieldWithValue("TxnID"; Txns::Transaction Serial)]
Set Variable{$$Result; Value:PCQB_RqAddFieldWithValue("PaymentAmount"; Txns::Amount Paid)]
Set Variable{$$Result; Value:PCQB_RqCloseRelatedRecord]
Set Variable{$$Result; Value:PCQB_BeginSession("Txns::Globals::qQB File Name; "Multi")]
Set Field [Txns_Globals::qQBVersionInfo; PCQB_GetCurrentQBVersion]
Perform Script ["Check for Errors"]
Set Variable [ $$Result; Value:PCQB_RsOpenFirstRecord]
Set Field [Txns::Transaction TxnID; PCQB_RsGetFirstFieldValue("RefNumber")]
Set Field [Txns::Transaction Creation Date; Get(CurrentDate)]
Set Variable [ $$Result; Value:PCQB_EndSession]
Commit Records/Requests [Skip data entry validation; No dialog]

Thanks so much for any advice!

Geoffrey Gerhard

  • Guru
  • Member
  • ****
  • Posts: 468
Re: Post Payment Not Recognizing Invoice
« Reply #1 on: February 09, 2012, 08:26:25 AM »
The error message suggests that the problem is in the value you're passing to one of the List Elements. The most likely culprit is this line...

Set Variable[$$Result; Value:PCQB_RqAddFieldWithValue("PaymentMethodRef::ListID"; Txns_Finance::Invoice TxnID)]

...which is expecting the ListID of the selected PaymentMethod. It appears, based on the field name, that you're passing the Invoice's Transaction ID value. It's also possible, though probably less likely, that the value passed to "CustomerRef::ListID" references a Customer that a user has deleted in QB.

One other item caught my eye--this line...

Set Field [Txns::Transaction TxnID; PCQB_RsGetFirstFieldValue("RefNumber")]

...may be wrong. Based on the field name, I'd expect "TxnID" where you've identified "RefNumber".


HTH!

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

jasonw75

  • Member
  • *
  • Posts: 4
Re: Post Payment Not Recognizing Invoice
« Reply #2 on: February 09, 2012, 09:03:58 AM »
Hi Geoffrey,

Thanks for the quick reply.  I think that I am, in fact, passing the Invoice Transaction ID in the line to which you referred.  Do you know the criteria for acceptable values for that field?

If that's not where I submit the Invoice Transaction ID to facilitate the association of the payment with the relevant invoice, can you suggest the specific command and placement for that argument?

Thanks very much for your help!!

jasonw75

  • Member
  • *
  • Posts: 4
Re: Post Payment Not Recognizing Invoice
« Reply #3 on: February 09, 2012, 12:04:37 PM »
Hi Geoffrey,

Thanks again for the reply.  Upon further research, I seem to have isolated the problem to the "PaymentMethodRef::ListID" line.  How would I obtain the ListID of the selected PaymentMethod to use as the parameter in that line?

Thanks very much!

Geoffrey Gerhard

  • Guru
  • Member
  • ****
  • Posts: 468
Re: Post Payment Not Recognizing Invoice
« Reply #4 on: February 09, 2012, 03:31:18 PM »
Addressing your last question, you could get the value by creating a Query Request for it and parsing the result. To do that, you'd need to know the Name of the Payment Method, and if you know the name of the Payment Method I'd replace this line...

Set Variable[$$Result; Value:PCQB_RqAddFieldWithValue("PaymentMethodRef::ListID"; Txns_Finance::Invoice TxnID)]

...with this line...

Set Variable[$$Result; Value:PCQB_RqAddFieldWithValue("PaymentMethodRef::FullName"; "YourPaymentMethodName" )]

...and the problem goes away.

HTH!


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

jasonw75

  • Member
  • *
  • Posts: 4
Re: Post Payment Not Recognizing Invoice
« Reply #5 on: February 09, 2012, 03:47:22 PM »
Thanks so much for your reply.  That step is no longer triggering an error (yay!), but now a subsequent step is...

Set Variable[$$Result; Value:PCQB_RqAddFieldWithValue("TxnID"; Txns::Transaction Serial)]

...is generating error 3000 - "The given object ID 'x' in the field 'transaction id' is invalid.'

The "Txns::Transaction Serial" field is simply a record id in FM for the transaction.  If it's expecting a QB id, from where would that be derived?

Thanks so much for your help!!

Geoffrey Gerhard

  • Guru
  • Member
  • ****
  • Posts: 468
Re: Post Payment Not Recognizing Invoice
« Reply #6 on: February 10, 2012, 06:03:21 AM »
It's expecting the TxnID value of the Invoice being paid.

Based on your field names, I'd expect to find that value in the Txns_Finance::Invoice TxnID or Txns::Transaction TxnID field, but that expectation is useless if you're not capturing the value when the Invoice is created. If you know the Invoice's RefNumber in QB (and it's guaranteed to be unique) you could do a Query Request to derive the TxnID value.

HTH!

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