我正在使用netsuite ruby gem(https://github.com/RevolutionPrep/netsuite)。
我和创业板的创始人谈过了,我用的是正确的方式抓住了一笔交易:
https://github.com/RevolutionPrep/netsuite/issues/52
在gemfile中:

gem 'netsuite'

在进行交易搜索时,我会一直看到:
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

这也会产生同样的错误:
search = NetSuite::Records::Transaction.get(:internal_id => 3820)

这是有效的:
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

这也管用:
NetSuite::Records::Customer.get(:internal_id => 3820)

这些不起作用:
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>'

这是有效的:
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)

最佳答案

不能提取交易记录–必须提取特定类型或交易记录。一些类型包括:发票、销售订单和现金销售。
尝试转到以下url:
https://system.netsuite.com/app/accounting/transactions/transaction.nl?id=3820
这将使您了解记录是什么事务类型如果是发票,您可以使用:

NetSuite::Records::Invoice.get(1234)

这里有一些关于NS事务流的粗略说明其中一些可能是特定于我们的实例的,但大多数都适用于整个NS,可能有助于您或其他试图拼凑NS工作方式的人。
大多数情况下,每一个现金销售(CS)和发票,都有一个与之相关联的销售订单(SO)如果是经常性收费(如每月服务费),则CS或发票不必有SO关联
销售订单可以有销售付款订单,也可以有与之关联的发票。例:如果有人用信用卡当场付款,那么它就会产生“现金销售”
SO、CS订单和发票都有相似的数据,但都有唯一的NS ID它们不是同一个数据的不同视图ala contact与同一个ns id上的customer视图。
即使在全额付款之后,销售订单也永远不会超过“付费”状态
交易是一个流程每条记录都在语义上表示某种东西因此,在正常的业务流中,一个可能作为另一个的结果生成所以,销售订单意味着,一个销售人员正在和一个人通电话,他们订购了一些东西,如果公司稍后会付款,那么当它收到“账单”时,就会生成一张发票,这是一份要求支付货物/服务的对账单

关于ruby-on-rails - 使用Netsuite Ruby Gem获取事务时出错-Savon::SOAPFault:(soapenv:Server.userException),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/22309483/

10-13 02:10