Productive Computing, Inc. Support Forum

Plug-ins => FM Books Connector => Topic started by: robertroll on April 26, 2010, 10:12:54 PM

Title: Extracting Transaction ID's from line item records on Purchase Order
Post by: robertroll on April 26, 2010, 10:12:54 PM
I am adding functionality to receive items from Purchase Order into QB, which is well documented in the SDK manual.  This appears to require that I have the QB transaction ID for each line item in order to match the receive transaction to the PO line.   The script steps below execute after I have executed a PO Add to extract the PO TxnID, and the first Line Item TxnLineID, but subsequent lines result in the first line's transaction's ID.  What am I doing wrong.

Set Field [ PO Main::q_qb_result; PCQB_RsOpenFirstRecord ]
Set Field [ PO Main::q_qb_po_number; PCQB_RsGetFirstFieldValue("RefNumber") ]
#Get TxnID
Set Field [ PO Main::q_qb_TxnID_t; PCQB_RsGetFirstFieldValue("TxnID") ]
#
#Get line item Txns
Go to Layout [ “LV POL” (PO_Line) ]
Go to Record/Request/Page [ First ]
Set Field [ PO Main::q_qb_result; PCQB_RsOpenFirstRelatedRecord( "PurchaseOrderLineRet" ) ]
Set Field [ PO_Line::q_Line_TxnID_t; PCQB_RsGetFirstFieldValue("TxnLineID") ]
Loop
Go to Record/Request/Page [ Next; Exit after last ]
Set Field [ PO Main::q_qb_result; PCQB_RsOpenNextRelatedRecord ]
Set Field [ PO_Line::q_Line_TxnID_t; PCQB_RsGetFirstFieldValue("TxnLineID") ]
End Loop
Set Field [ PO Main::q_qb_result; PCQB_RsCloseRelatedRecord ]
Go to Layout [ original layout ]
#
Set Field [ PO Main::q_qb_result; PCQB_EndSession ]


Robert Roll
Integral Circuits-San Francisco, CA
RobertR@sonic.net
Title: Re: Extracting Transaction ID's from line item records on Purchase Order
Post by: Chris on April 28, 2010, 08:34:23 AM
This is the first time I have heard of this behavior.   
Two questions:
Are you certain that all line items are added to the PuchaseOrder?
What value is returned by the PCQB_RsOpenNextRelatedRecord function ?

Chris
Title: Re: Extracting Transaction ID's from line item records on Purchase Order
Post by: Geoffrey Gerhard on April 28, 2010, 09:45:15 AM
Are there any auto-enter options applied to the "PO_Line::q_Line_TxnID_t" field's definition?


Geoffrey Gerhard
Creative Solutions Incorporated
14000 Creekside Drive
Matthews, NC  28105
704) 814-6852
704) 814-6853 (FAX)
Title: Re: Extracting Transaction ID's from line item records on Purchase Order
Post by: robertroll on April 28, 2010, 11:20:16 PM
Oops, Line item TxnID FM field was duplicated from a field defined as a global field.  This script actually works!   Well, now there is an example on the forum. 

Sorry about that and thanks for taking a look.

:-[

Robert Roll
Integral Circuits
San Francisco, CA