Author Topic: Specifiying Invoice Template not working........  (Read 1549 times)

trebor

  • Member
  • *
  • Posts: 57
Specifiying Invoice Template not working........
« on: April 21, 2015, 07:57:36 AM »
I need to send over an invoice and specify the template to be used for that invoice.  I pull the Template Name and ListID, and when sending over to QB it does not specify the Template I tell it to in the script (see Below). I have tried both the ListID and Template name and neither one sets the template for the invoice.  Currently I have the Template ListID hardwired but still no go (see bold step). It adds the invoice, just does not set the template.  Odd.  If there was something wrong, i would expect an error, but get none.

Any ideas?

Send Invoice to QB2
#Prep for Invoice
Set Field [ QB_Clients::Result ; PCQB_RqNew( "InvoiceAdd"; ) ]
Set Field [ QB_Clients::Result ; PCQB_RqAddFieldWithValue( "CustomerRef::ListID"; QB_Clients::Client_ListID; ) ]
Set Field [ QB_Clients::Result ; PCQB_RqAddFieldWithValue( "TemplateRef::ListID";"8000000F-1342454356"; ) ]
Set Field [ QB_Clients::Result ; PCQB_RqAddFieldWithValue( "TxnDate";Soifer::report_date; ) &
PCQB_RqAddFieldWithValue( "IsToBePrinted";"true"; ) ]
#Prep Invoice Line Items
Set Variable [ $loop; Value:1 ]
Loop
Set Field [ QB_Clients::Result ; PCQB_RqAddRelatedRecord( "InvoiceLineAdd"; ""; ) ]
Set Field [ QB_Clients::Result ; PCQB_RqAddFieldWithValue( "ItemRef::FullName"; Current_Clients::QB_Invoice_Description_Item
[$loop]; ) &
PCQB_RqAddFieldWithValue( "Desc";"Speech/Language Therapy" &¶&Current_Clients::QB_Invoice_Description[$loop]; ) &
PCQB_RqAddFieldWithValue( "Quantity";Current_Clients::QB_Invoice_Description_QTY[$loop] ; ) ]
Set Field [ QB_Clients::Result ; PCQB_RqCloseRelatedRecord ]
Set Variable [ $loop; Value:$loop+1 ]
Go to Layout [ “Crrent_Clients _Billing” (Current_Clients) ]
Exit Loop If [ $loop >Current_Clients::repeating_fields_count ]
Go to Layout [ original layout ]
End Loop
#Create Invoice (Begin session, execute, close session)
Set Field [ QB_Clients::Result ; PCQB_BeginSession( ""; "" ) ]
Set Field [ QB_Clients::Result ; PCQB_RqExecute ]
Set Field [ QB_Clients::Result ; PCQB_EndSession ]
#Capture QB Invoice number
Set Field [ Billing_Data::Invoice number ; PCQB_RsOpenFirstRecord ]
Set Variable [ $QB_Invoice_Num ; Value:PCQB_RsGetFirstFieldValue( "RefNumber" ) ]

Thanks
Rob

Geoffrey Gerhard

  • Guru
  • Member
  • ****
  • Posts: 470
Re: Specifiying Invoice Template not working........
« Reply #1 on: April 21, 2015, 08:15:33 AM »
When you look at the InvoiceAdd Response, what's the value of the TemplatRef::ListID element?

Which version of QB?


Geoffrey Gerhard
Creative Solutions Incorporated
14000 Creekside Drive
Matthews, NC  28105
704) 814-6852
« Last Edit: April 21, 2015, 08:18:46 AM by Geoffrey Gerhard »

trebor

  • Member
  • *
  • Posts: 57
Re: Specifiying Invoice Template not working........
« Reply #2 on: April 21, 2015, 09:10:23 AM »
My total ignorance showing, where do i  get the InvoiceAdd Response?  I pulled the XML response, but I am not sure that is what I was looking for.  No reference to Template name or ID.

<?xml version="1.0"?>
<QBXML>
   <QBXMLMsgsRs>
      <InvoiceAddRs statusCode="3000" statusSeverity="Error" statusMessage="The given object ID &quot;&quot; in the field &quot;list id&quot; is invalid. "/>
   </QBXMLMsgsRs>
</QBXML>

However I am sending the Template name not list id. It creates the Invoice though.  So it cannot be the listID for the client that it is complaining about.

Thanks
Rob


trebor

  • Member
  • *
  • Posts: 57
Re: Specifiying Invoice Template not working........
« Reply #3 on: April 21, 2015, 10:20:55 AM »
Not too sure what I did, but it is now working as I intend it to.  I re-updated my Customer table (thinking the ID failure was coming from there) and it seemed to go through, picking the proper invoice template i want to use.

All is back well with the world, until the next problem......

Thanks
Rob

Geoffrey Gerhard

  • Guru
  • Member
  • ****
  • Posts: 470
Re: Specifiying Invoice Template not working........
« Reply #4 on: April 21, 2015, 11:47:18 AM »
Your original post shows TemplateRef::ListID. Are you using TemplateRef::FullName?

Your second post shows an InvoiceAdd Response that failed because an unspecified ListID value was invalid. Unfortunately, the Error messages never identify which node's ListID caused the Error.

If you switched to TemplateRef::FullName for your last try, it points to the TemplateRef::ListID as the source.

HTH!

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

trebor

  • Member
  • *
  • Posts: 57
Re: Specifiying Invoice Template not working........
« Reply #5 on: April 27, 2015, 11:09:08 AM »
I originally had it with the ID then I used the FullName.

I am working on a  machine that is only using the demo right now so maybe I timed out and did not realize it.

Hum, must be a way to check for that, will add that in to future routines.