I'm using the netsuite ruby gem (https://github.com/RevolutionPrep/netsuite).
I talked to the founder of the gem and I'm using the correct way of grabbing a transaction: https://github.com/RevolutionPrep/netsuite/issues/52
In Gemfile:
gem 'netsuite'
I keep getting this when doing the transaction search:
1.9.3p448 :008 > search = NetSuite::Records::Transaction.get(3820)
HTTPI GET request to webservices.netsuite.com (net_http)
HTTPI POST request to webservices.netsuite.com (net_http)
Savon::SOAPFault: (soapenv:Server.userException) org.xml.sax.SAXException: transaction is not a legal value for {urn:types.core_2013_2.platform.webservices.netsuite.com}RecordType
This gives the same error as well:
search = NetSuite::Records::Transaction.get(:internal_id => 3820)
This works:
def getAllTransactions
#SearchStringField, searchValue
t = Time.new
search = NetSuite::Records::Transaction.search({
criteria: {
basic: [
{
field: 'type',
operator: 'anyOf',
type: 'SearchEnumMultiSelectField',
value: [ "_invoice" ]
},
{
field: 'tranDate',
operator: 'within',
type: 'SearchDateField',
value: [
Date.parse("12/1/2013").strftime("%Y-%m-%dT%H:%M:%S%z"),
Date.parse("#{t.month}/#{t.day}/#{t.year}").strftime("%Y-%m-%dT%H:%M:%S%z")
]
}
]
}
})
search
end
And this works too:
NetSuite::Records::Customer.get(:internal_id => 3820)
These don't work:
1.9.3p448 :007 > customer = NetSuite::Records::Invoice.get(:internal_id => 7996)
HTTPI GET request to webservices.netsuite.com (net_http)
HTTPI POST request to webservices.netsuite.com (net_http)
NetSuite::RecordNotFound: NetSuite::Records::Invoice with OPTIONS={:internal_id=>7996} could not be found
from /Users/pkatepalli/.rvm/gems/ruby-1.9.3-p448/gems/netsuite-0.2.0/lib/netsuite/actions/get.rb:73:in `get'
from (irb):7
from /Users/pkatepalli/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/commands/console.rb:47:in `start'
from /Users/pkatepalli/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/commands/console.rb:8:in `start'
from /Users/pkatepalli/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:5:in `require'
from script/rails:5:in `<main>'
1.9.3p448 :008 > customer = NetSuite::Records::SalesOrder.get(:internal_id => 7996)
HTTPI GET request to webservices.netsuite.com (net_http)
HTTPI POST request to webservices.netsuite.com (net_http)
NetSuite::RecordNotFound: NetSuite::Records::SalesOrder with OPTIONS={:internal_id=>7996} could not be found
from /Users/pkatepalli/.rvm/gems/ruby-1.9.3-p448/gems/netsuite-0.2.0/lib/netsuite/actions/get.rb:73:in `get'
from (irb):8
from /Users/pkatepalli/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/commands/console.rb:47:in `start'
from /Users/pkatepalli/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/commands/console.rb:8:in `start'
from /Users/pkatepalli/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:5:in `require'
from script/rails:5:in `<main>'
1.9.3p448 :009 > customer = NetSuite::Records::CashSale.get(:internal_id => 7996)
HTTPI GET request to webservices.netsuite.com (net_http)
HTTPI POST request to webservices.netsuite.com (net_http)
NetSuite::RecordNotFound: NetSuite::Records::CashSale with OPTIONS={:internal_id=>7996} could not be found
from /Users/pkatepalli/.rvm/gems/ruby-1.9.3-p448/gems/netsuite-0.2.0/lib/netsuite/actions/get.rb:73:in `get'
from (irb):9
from /Users/pkatepalli/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/commands/console.rb:47:in `start'
from /Users/pkatepalli/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/commands/console.rb:8:in `start'
from /Users/pkatepalli/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:5:in `require'
from script/rails:5:in `<main>'
this works:
1.9.3p448 :010 > customer = NetSuite::Records::Customer.get(:internal_id => 7996)
HTTPI GET request to webservices.netsuite.com (net_http)
HTTPI POST request to webservices.netsuite.com (net_http)
You can't pull a Transaction record – you have to pull a specific type or transaction record. Some types include: Invoice, SalesOrder, and CashSale.
Try going to the following url:
https://system.netsuite.com/app/accounting/transactions/transaction.nl?id=3820
This should give you an idea of what transaction type the record is. If it's an Invoice, you would retrieve it using:
NetSuite::Records::Invoice.get(1234)
Here are some rough notes on the NS transaction flow. Some of it might be specific to our instance, but the majority of it applies to NS as a whole and might be helpful to you or others trying to piece together how NS works.