Author Topic: Adding NonInventory Error 3130  (Read 1737 times)

gmainis

  • Member
  • *
  • Posts: 7
Adding NonInventory Error 3130
« on: July 31, 2012, 03:43:54 PM »
Hi
Starting the integration into QB and I have a problem I can overcome.  I get an error 3130 "There is an invalid reference to a parent "Brkg Income" in the Items list.  Invaild argument." 

Here's the code I wrote to add a non-inventory item into QB:

 Perform Script [“   Plug-in Checker”]
 Set Field [ORDERHD::gQb_Response; PCQB_EndSession]
 Set Variable [$$Result; Value:PCQB_RqNew( "ItemNonInventoryAdd" ;"" )]
 Set Variable [$$Result; Value:PCQB_RqAddFieldWithValue( "Name" ;Orderhd_CoName~Trigger::QB_Item_Brkg ) // hold the item ID]
 Set Variable [$$Result; Value:PCQB_RqAddFieldWithValue( "IsActive" ;1 )]
 Set Variable [$$Result; Value:PCQB_RqAddFieldWithValue( "ParentRef::FullName" ;$Name ) //$name is the product description]
 Set Variable [$$Result; Value:PCQB_RqAddFieldWithValue( "SalesTaxCodeRef::FullName" ;"NON" ) //Non tax item]
 Set Variable [$$Result; Value:PCQB_RqAddFieldWithValue( "SalesOrPurchase::AccountRef::ListID" ;Orderhd_CoName~Trigger::QB_Item_Brkg_Acct ) //Account Number]
 #Begin Session
 Set Field [ORDERHD::gQb_Response; PCQB_BeginSession(Orderhd_CoName~Trigger::QB_FileName;"")]
 If [ORDERHD::gQb_Response = "!!Error!!"]
   Show Custom Dialog ["Warning"; PCQB_SGetStatus]
 ##Close Session
   Set Field [ORDERHD::gQb_Response; PCQB_EndSession]
   Halt Script
 Else
 Set Field [ORDERHD::gQb_Response; PCQB_RqExecute]
   If [ORDERHD::gQb_Response = "!!Error!!"]
   Show Custom Dialog ["Warning"; PCQB_SGetStatus]
   End If
 End If


Thank you in advance - any help would be appreciated.

Greg

Geoffrey Gerhard

  • Guru
  • Member
  • ****
  • Posts: 470
Re: Adding NonInventory Error 3130
« Reply #1 on: July 31, 2012, 08:18:44 PM »
Is there a "Brkg Income" Item already in QB? Make sure that the FullName in QB matches the name you're passing in the Add Request.

HTH!

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

gmainis

  • Member
  • *
  • Posts: 7
Re: Adding NonInventory Error 3130
« Reply #2 on: August 01, 2012, 08:38:37 AM »
Hi Geoff, thanks for helping.

The "Brkg Income" is the a description name of the item I'm attempting to add to QB from line 6 of my code.  Since I'm adding a new non inventory item there is nothing for me to "match" to in QB.  I'm I misunderstanding something here?

Greg

Geoffrey Gerhard

  • Guru
  • Member
  • ****
  • Posts: 470
Re: Adding NonInventory Error 3130
« Reply #3 on: August 01, 2012, 09:10:59 AM »
Your Add Request should only pass a ParentRef::FullName value when the Item you're adding is the "child" of another Item. Use...

Set Variable [$$Result; Value:PCQB_RqAddFieldWithValue( "SalesOrPurchase::Desc" ; $Name )

...just above your call that adds a value to the "SalesOrPurchase::AccountRef::ListID" element to pass the value to the Item's Description.

HTH!

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

gmainis

  • Member
  • *
  • Posts: 7
Re: Adding NonInventory Error 3130
« Reply #4 on: August 01, 2012, 10:42:00 AM »
Thanks Geoff for you help.  Here is the code that sends a NonInventory Item to QB:

  Perform Script [“   Plug-in Checker”]
  Set Variable [$Name; Value:"Brkg Income Item"]
  Set Field [ORDERHD::gQb_Response; PCQB_EndSession]
  Set Variable [$$Result; Value:PCQB_RqNew( "ItemNonInventoryAdd" ;"" )]
  Set Variable [$$Result; Value:PCQB_RqAddFieldWithValue( "Name" ;Orderhd_CoName~Trigger::QB_Item_Brkg ) // hold the item ID]
  Set Variable [$$Result; Value:PCQB_RqAddFieldWithValue( "IsActive" ;1 )]
  Set Variable [$$Result; Value:PCQB_RqAddFieldWithValue( "SalesTaxCodeRef::FullName" ;"NON" ) //Non tax item]
  Set Variable [$$Result; Value:PCQB_RqAddFieldWithValue( "SalesOrPurchase::Desc" ;$Name ) //Item Description]
  Set Variable [$$Result; Value:PCQB_RqAddFieldWithValue( "SalesOrPurchase::AccountRef::FullName" ;Orderhd_CoName~Trigger::QB_Item_Brkg_Acct ) //Account Number]
  #Begin Session
  Set Field [ORDERHD::gQb_Response; PCQB_BeginSession(Orderhd_CoName~Trigger::QB_FileName;"")]
  If [ORDERHD::gQb_Response = "!!Error!!"]
    Show Custom Dialog ["Warning"; PCQB_SGetStatus]
    Show Custom Dialog ["Warning"; "If you are using Windows Vista, be sure you have \"User Account Control\" turned on."]
  ##Close Session
    Set Field [ORDERHD::gQb_Response; PCQB_EndSession]
  H Halt Script
  Else
    Set Field [ORDERHD::gQb_Response; PCQB_RqExecute]
    If [ORDERHD::gQb_Response = "!!Error!!"]
      Show Custom Dialog ["Warning"; PCQB_SGetStatus]
    End If
  End If