Author Topic: ItemService Add  (Read 2396 times)

spastaman

  • Member
  • *
  • Posts: 8
ItemService Add
« on: October 06, 2011, 03:44:11 PM »
Hello,

I have been able to successfully add Inventory Items form FM_items, but I can't get my FM_items to be added to QB as Service Items...my script looks like this:

Set Variable [ $$Result ; Value:PCQB_RqNew("ItemServiceAdd" ; "" )
Set Variable [ $$Result ; Value:PCQB_RqNew("FullName" ; $_name )  - note: $_name is set from valid field value
Set Variable [ $$Result ; Value:PCQB_RqNew("SalesOrPurchase::Desc" ; $_desc )
Set Variable [ $$Result ; Value:PCQB_RqNew("SalesOrPurchase::Price" ; $_price )
Set Variable [ $$Result ; Value:PCQB_RqNew("IncomeAccountRef" ; $_acct.income )

// I removed the COGS and ASSET accounts that were used adding InventoryItems

Set Variable [ $$Result ; Value: PCQB_BeginSession(Main::gQB File Name )

// error check
Set fields...Main::gCountry, and Main::gConnection, Main::gQB_Verion

// error check

Set Variable [ $$Result ; Value:PCQB_RqExecute ]

// here is where $$Result = -1000, No Respionse saved

Help???

Thank you!!



Geoffrey Gerhard

  • Guru
  • Member
  • ****
  • Posts: 470
Re: ItemService Add
« Reply #1 on: October 06, 2011, 04:55:05 PM »
Several problems with the code you posted:

The first is that you're not using the right plug-in function call on several of your Set Variable steps.

The first Set Variable step is correct, but Set Variable steps 2-5 should be using PCQB_RqAddFieldWithValue, not PCQB_RqNew.

In addition, the second Set Variable step should be using the QBFieldName "Name", not "FullName".

Also, the fifth Set Variable step should be using the QBFieldName "SalesOrPurchase::AccountRef::FullName" or "SalesOrPurchase::AccountRef::ListID", not "IncomeAccountRef".


There may be other problems, but these were the ones that jumped out at me.

HTH!

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

spastaman

  • Member
  • *
  • Posts: 8
Re: ItemService Add
« Reply #2 on: October 11, 2011, 11:31:00 AM »
G

Thanks for the leg-up...

Firstly, the PCQB_Rq in subsequent variables after first - those were typos, in my haste I copied/pasted first one and only changed the field names.

"There may be other problems, but these were the ones that jumped out at me." - Hah, that's an understatement. Here's what I finally got working:

Set Variable [ $$Result ; Value:PCQB_RqNew("ItemServiceAdd" ; "" )
Set Variable [ $$Result ; Value:PCQB_RqAddFieldWithValue("Name" ; $_name )  - note: $_name is set from valid field value
Set Variable [ $$Result ; Value:PCQB_RqAddFieldWithValue("IsActive" ; 1 )
Set Variable [ $$Result ; Value:PCQB_RqAddFieldWithValue("ParentRef::FullName" ; $_parent_name )
Set Variable [ $$Result ; Value:PCQB_RqAddFieldWithValue("SalesOrPurchase::Desc" ; $_desc )
Set Variable [ $$Result ; Value:PCQB_RqAddFieldWithValue("SalesOrPurchase::AccountRef::ListID" ; $_id.account )
Set Variable [ $$Result ; Value: PCQB_BeginSession(Main::gQB File Name )
// error check
Set fields...Main::gCountry, and Main::gConnection, Main::gQB_Verion
// error check
Set Variable [ $$Result ; Value:PCQB_RqExecute ]

 ::)

Thanks again!