Author Topic: DataExt in SalesOrderAdd Request  (Read 4607 times)

bpmark

  • Member
  • *
  • Posts: 9
DataExt in SalesOrderAdd Request
« on: January 28, 2010, 09:41:46 AM »
I am successfully sending data to a single custom field in a SalesOrder, but on attempting to push a second one I get an error. The relevant XML looks like this...

      <SalesOrderLineAdd>
          <ItemRef>
            <ListID>E40000-1097531960</ListID>
          </ItemRef>
          <Desc>APPETIZER, FZN, CHEESE STICKS, MOZZARELLA, BTRD, 4/3 LB CO</Desc>
          <Quantity>1728.00000</Quantity>
          <Rate>27.94</Rate>
          <Other2>0</Other2>
          <DataExt>
            <OwnerID>0</OwnerID>
            <DataExtName>Gross Price</DataExtName>
            <DataExtValue>28.94</DataExtValue>
            <OwnerID>0</OwnerID>
            <DataExtName>NAPA Allowance</DataExtName>
            <DataExtValue>1</DataExtValue>
          </DataExt>
        </SalesOrderLineAdd>
      </SalesOrderAdd>

..with the second DataExt item lacking an Open/Close tag.

The SetVariable script step currently looks like this...

Let ( [
TARGET = "Gross Price" ;      //From the Custom Fields established in QuickBooks Items
VALUE = Case (
$PARAM = "SOLI" ; SO_SOLI_QB::Cost_Manufacturer ;
SO_ConLine_SOLI::Cost_Manufacturer ) ] ;

PCQB_RqAddFieldWithValue ( "DataExt::OwnerID" ; "0" ) & "" &
PCQB_RqAddFieldWithValue ( "DataExt::DataExtName" ; TARGET ) & "" &
PCQB_RqAddFieldWithValue ( "DataExt::DataExtValue" ; VALUE )
)

Any thoughts? Thanks.

Mark D Kerr

bpmark

  • Member
  • *
  • Posts: 9
Re: DataExt in SalesOrderAdd Request
« Reply #1 on: January 28, 2010, 11:11:13 AM »
Reply to self...

Adding the open close tags directly to the XML to change...

          <DataExt>
            <OwnerID>0</OwnerID>
            <DataExtName>Gross Price</DataExtName>
            <DataExtValue>28.94</DataExtValue>
            <OwnerID>0</OwnerID>
            <DataExtName>NAPA Allowance</DataExtName>
            <DataExtValue>1</DataExtValue>
          </DataExt>
into...

          <DataExt>
            <OwnerID>0</OwnerID>
            <DataExtName>Gross Price</DataExtName>
            <DataExtValue>28.94</DataExtValue>
          </DataExt>
          <DataExt>
            <OwnerID>0</OwnerID>
            <DataExtName>NAPA Allowance</DataExtName>
            <DataExtValue>1</DataExtValue>
          </DataExt>

Results in a successful request being processed in Quickbooks.

Mark D Kerr

bpmark

  • Member
  • *
  • Posts: 9
Re: DataExt in SalesOrderAdd Request
« Reply #2 on: February 03, 2010, 06:04:37 PM »
Just an FYI, used the Substitute function to insert the "</DataExt><DataExt>" (Close-Open) tags to process the prior fix as follows:

PCQB_RqUseXML ( Substitute ( PCQB_SGetXML ( "Request" ; "" ) ;
"</DataExtValue><OwnerID>" ; "</DataExtValue></DataExt><DataExt><OwnerID>" ) ; "" )

Mark

Chris

  • God
  • Member
  • *****
  • Posts: 83
Re: DataExt in SalesOrderAdd Request
« Reply #3 on: February 04, 2010, 04:28:09 PM »
Hi All,
The surefire way of adding a value for a custom field requires creating a DateExtMod request and populating the fields before executing.  The list of steps follows...

PCQB_RqNew( "DataExtMod" )
PCQB_RqAddFieldWithValue( "OwnerID"  ; "0" ) //OwnerID is always 0
PCQB_RqAddFieldWithValue( "DataExtName"  ; TheNameOfTheCustomField )
if( setting custom field in a transaction )
 #for setting the custom field in a txn...
 PCQB_RqAddFieldWithValue( "TxnDataExtType"  ; TxnType )
 PCQB_RqAddFieldWithValue( "TxnID"  ; TheTxnIDOfTheTxn )
 //the next line is only to apply the custom field value to the particular line item of the txn
 PCQB_RqAddFieldWithValue( "TxnLineID" ; TheTxnLineIDOfTheLineItemInTheTxn )
else if(setting for an entity or list item )
 #for setting the custom field in a list item
 PCQB_RqAddFieldWithValue( "ListDataExtType"  ; ListType )
 PCQB_RqAddFieldWithValue( "ListObjRef::ListID"  ; TheListIDOfTheItem )
end if
PCQB_RqAddFieldWithValue( "DataExtValue" ; TheValueForTheCustomField )

Valid values for the TxnType are:
ARRefundCreditCard, Bill, BillPaymentCheck, BillPaymentCreditCard, BuildAssembly, Charge, Check, CreditCardCharge, CreditCardCredit, CreditMemo, Deposit, Estimate, InventoryAdjustment, Invoice, ItemReceipt, JournalEntry, PurchaseOrder, ReceivePayment, SalesOrder, SalesReceipt, SalesTaxPaymentCheck, VendorCredit

Valid values for the ListType are:
Account, Customer, Employee, Item, OtherName, Vendor


Chris