Author Topic: Invoice can't be found after ReceivePaymentAdd problem  (Read 245 times)

wendy

  • Member
  • *
  • Posts: 4
Invoice can't be found after ReceivePaymentAdd problem
« on: June 19, 2017, 04:09:29 PM »
I have a script which enters payments into QB using ReceivePaymentAdd. Occasionally there is a problem if the PaymentAmount has not been formatted correctly. (The bookkeeper adds an extra $, etc.) I decided to allow the user to edit the entered amount through a custom dialog and then attempt to enter it into QB again. However, when it tries again, it always gives the error 'Object "25DA1-1497904176" specified in the request cannot be found.' (Where the object is the TxnID for the invoice it is attempting to apply the payment to.)  I have double checked that the TxnID for the invoice is correct.

Any ideas?

Geoffrey Gerhard

  • Guru
  • Member
  • ****
  • Posts: 470
Re: Invoice can't be found after ReceivePaymentAdd problem
« Reply #1 on: June 20, 2017, 06:29:17 AM »
Did the targeted QB Invoice get Deleted or Voided?

Is the error coming from a ReceivePaymentMod or a ReceivePaymentAdd Request?

( If the latter, you'll need to Void or Delete the original ReceivePayment Txn before sending the new/replacement ReceivePaymentAdd. )

Is the TxnID in the error attached to the correct TxnID node in the Request?

It might be helpful to post the complete error message here.

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

wendy

  • Member
  • *
  • Posts: 4
Re: Invoice can't be found after ReceivePaymentAdd problem
« Reply #2 on: June 20, 2017, 10:05:52 AM »
The invoice did not get deleted. The error is coming from a ReceivePaymentAdd request. I'm assuming that, since there was an error, it didn't actually enter the payment. Is that not correct? Do I need to somehow delete it? 

Here's the error:
CODE: 3120
SEVERITY: Error
MESSAGE: Object "25D9E-1497904175" specified in the request cannot be found.


Here's the entire loop.

Loop
Exit Loop If [ Get(FoundCount) = 0 ]
Set Variable [ $result; Value:PCQB_RqNew( "ReceivePaymentAdd" ; "" ) ]
Set Variable [ $result; Value:PCQB_RqAddFieldWithValue( "CustomerRef::FullName" ; payments|INVOICES::Short Name ) ] Set Variable [ $result; Value:PCQB_RqAddFieldWithValue( "ARAccountRef::FullName" ; "Interpreting Receivable" ) ]
Set Variable [ $result; Value:PCQB_RqAddFieldWithValue( "TxnDate" ; PAYMENTS::Date Received ) ]
Set Variable [ $result; Value:PCQB_RqAddFieldWithValue( "RefNumber" ; PAYMENTS::Invoice Number ) ]
Set Variable [ $result; Value:PCQB_RqAddFieldWithValue( "TotalAmount" ; PAYMENTS::Amount ) ]
Set Variable [ $result; Value:PCQB_RqAddFieldWithValue( "DepositToAccountRef:FullName" ; "Undeposited Funds" ) ]
Set Variable [ $result; Value:PCQB_RqAddFieldWithValue( "AppliedToTxnAdd:TxnID" ; payments|INVOICES::_QB Txn ID ) ] Set Variable [ $result; Value:PCQB_RqAddFieldWithValue( "AppliedToTxnAdd:PaymentAmount" ; PAYMENTS::Amount ) ]
Set Variable [ $result; Value:PCQB_RqExecute ] If[$result ≠0]
Set Variable [ $error; Value:PCQB_SGetStatus & "¶" & PAYMENTS::Invoice Number & "¶" & PAYMENTS::Date Received
& "¶" & payments|INVOICES::Short Name & "¶" ]
Set Variable [ $error.list; Value:List ( $error.list; $error ) ]
Show Custom Dialog [ Title: "Get Status"; Message: $error; Default Button: “OK”, Commit: “No”; Button 2: “Edit Amount”, Commit: “Yes”; Button 3: “Exit Script”, Commit: “No”; Input #1: PAYMENTS::Amount, "Payment Amount" ]
If [ Get(LastMessageChoice) = 3 ]
Set Variable [ $result; Value:PCQB_EndSession ] Set Variable [ $smtp.account; Value:"confirmations" ]
Send Mail...
[ No dialog ] Exit Script [ ]
End If End If
If [ Get(LastMessageChoice) = 2 ] Else
Set Variable [ $result; Value:PCQB_RsOpenFirstRecord ]
Set Field [ PAYMENTS::_QB Txn ID; PCQB_RsGetFirstFieldValue( "TxnID" ) ] Omit Record
End If
End Loop

Thanks.
« Last Edit: June 20, 2017, 10:15:12 AM by wendy »

Geoffrey Gerhard

  • Guru
  • Member
  • ****
  • Posts: 470
Re: Invoice can't be found after ReceivePaymentAdd problem
« Reply #3 on: June 21, 2017, 07:20:59 AM »
If the ReceivePaymentAdd Request returned an error, it did not get created.

What error is returned in the first iteration of the Loop? (Confirming that it's an issue with the PaymentAmount and that you never get the AppliedToTxnAdd/TxnID error on the first iteration of the loop)

QB Requests halt at the first error encountered, so it's possible that the TxnID is wrong through all iterations and only shows once the data format error in the PaymentAmount value is eliminated.

Have you confirmed that the targeted QB Invoice is not Voided or Paid?

Have you looked at the XML for the second iteration's ReceivePaymentAdd Request? If you're using FMP Advanced with the Script Debugger running, see what the Data Viewer shows when you evaluate PCQB_SGetXML( "Request" ; "" ) ahead of the PCQB_RqExecute step.

If you don't see the error, post the Result here--I'd be glad to put a second set of eyes on it.

HTH!

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