问题
I want to get a list of all InventoryItems According to this document: https://system.netsuite.com/help/helpcenter/en_US/Output/Help/SuiteCloudCustomizationScriptingWebServices/SuiteTalkWebServices/getAll.html
I'm forming the following request:
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:platformMsgs="urn:platform_2013_1.webservices.netsuite.com" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header>
<passport>
<email>******</email>
<password>******</password>
<account>******</account>
</passport>
</env:Header>
<env:Body>
<platformMsgs:getAll>
<recordType>InventoryItem</recordType>
</platformMsgs:getAll>
</env:Body>
</env:Envelope>
But receiving response with the error:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<platformMsgs:documentInfo xmlns:platformMsgs="urn:messages_2013_1.platform.webservices.netsuite.com">
<platformMsgs:nsId>WEBSERVICES_969904_100920131651936419141601801_cbf1690968b43</platformMsgs:nsId>
</platformMsgs:documentInfo>
</soapenv:Header>
<soapenv:Body>
<getAllResponse xmlns="urn:platform_2013_1.webservices.netsuite.com">
<platformCore:getAllResult xmlns:platformCore="urn:core_2013_1.platform.webservices.netsuite.com">
<platformCore:status isSuccess="false">
<platformCore:statusDetail type="ERROR">
<platformCore:code>GETALL_RCRD_TYPE_REQD</platformCore:code>
<platformCore:message>The getAll record type is required.</platformCore:message>
</platformCore:statusDetail>
</platformCore:status>
</platformCore:getAllResult>
</getAllResponse>
</soapenv:Body>
</soapenv:Envelope>
I've tried to request currencies, states - the response always the same
I've tried following variants:
<GetAllRecordType>inventoryItem</GetAllRecordType>
and
<recordType>inventoryItem</recordType>
and
<GetAllRecordType>currency</GetAllRecordType>
and
<recordType>currency</recordType>
with the same response:
<platformCore:message>The getAll record type is required.</platformCore:message>
According to https://webservices.netsuite.com/xsd/platform/v2013_2_0/coreTypes.xsd - I've specified correctly recordType (btw I've also tried without any success)
I'm using ruby and there is no complete library for ruby. The one that is exists doesn't contain almost all things I'm going to use.
Can someone help me what I'm doing wrong or may be someone have working example
回答1:
getAll cannot be used for all record types. Here is what is supported via getAll:
budgetCategory
campaignAudience
campaignCategory
campaignChannel
campaignFamily
campaignOffer
campaignSearchEngine
campaignSubscription
campaignVertical
costCategory
currency
leadSource
salesTaxItem
state
supportCaseIssue
supportCaseOrigin
supportCasePriority
supportCaseStatus
supportCaseType
taxGroup
taxType
回答2:
inventoryItem, not InventoryItem.
Also, what language are you using? If PHP, there is a PHPToolkit to help you out.
回答3:
As Dave suggested, the request will be case-sensitive, so make sure the value you use matches exactly what the XSD says.
If you scroll down the XSD further, you will see the enumeration for GetAllRecordType
instead of just RecordType
. This does not have an entry for inventoryItem
or anything similar, so Inventory Items are most likely not available in this type of request.
You may instead have to build an Item search with no filters to return all Inventory Items.
回答4:
The most complete implementation of SuiteTalk in Ruby is the netsuite ruby gem.
It doesn't yet support ItemSearchAdvanced
(note that unlike most NetSuite records there isn't a ItemSearchBasic
). Also, note that there isn't a InventoryItemAdvancedSearch
, NonInventoryItemAdvancedSearch
, etc like you would expect. Take a look at the lists.accounting.xsd
for more information in the schema browser.
Like someone else mentioned, there is no getAll
call for item record types. The best (and possibly only) way to get all of the items in a NetSuite instance is do a paginate through a search and combine all of the results.
I've coded a quick hack to demonstrate what needs to be done in order to implement item searching in the NetSuite gem. I wouldn't use the referenced hack in production, but could you easily integrate item searching into the NetSuite gem using the info the above referenced hack.
Below is searching code that, when used in combination with the above hack, will get you all of the items in your NetSuite instance.
item_list = []
item_search = NetSuite::Records::InventoryItem.search(
criteria: {
basic: [
]
},
preferences: {
page_size: 100,
}
)
item_search.results_in_batches do |batch|
item_list += batch
end
(the above code will probably break if the search returns a NonInventoryItem
or another item record that isn't a InventoryItem
, but this should be enough to get you started)
回答5:
I stumbled upon this question with the same issue as
<platformCore:message>The getAll record type is required.</platformCore:message>
Figured I would come post a snippet of what a proper soap envelope should look like for this request. As others have mentioned, this call only supports certain record types...but once you identify the record type you desire, the below code should help.
<soap:Envelope xmlns:platformFaults="urn:faults_2014_1.platform.webservices.netsuite.com" xmlns:platformMsgs="urn:messages_2014_1.platform.webservices.netsuite.com" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="urn:platform_2014_1.webservices.netsuite.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Header>
<passport>
<email>test@example.com</email>
<password>*******</password>
<account>AccountNumber</account>
<role internalId="3"/>
</passport>
</soap:Header>
<soap:Body>
<platformMsgs:getAll xmlns="urn:messages_2014_1.platform.webservices.netsuite.com" xmlns:platformMsgs="urn:messages_2014_1.platform.webservices.netsuite.com">
<platformMsgs:record recordType="currency"/>
</platformMsgs:getAll>
</soap:Body>
</soap:Envelope>
Also we are using the node-soap module to communicate with this web service and here is what it looks like from that perspective as well.
soap.createClient(this.url, function (err, client) {
client.addSoapHeader({
passport: {
email: 'test@example.com',
password: 'pass',
account: 'Acct Number',
role: {
attributes: { internalId: 3 }
}
}
});
client.getAll({
"record": {
"attributes": {
"recordType": "currency"
}
}
}, callback);
});
});
Anyways I hope this helps others as it did stump me for awhile.
回答6:
For anyone using PHP and specially this library you can specify the record type this way:
$getAllRequest = new GetAllRequest();
$getAllRequest->record = new GetAllRecord();
$getAllRequest->record->recordType = RecordType::currency;
$getAllResponse = $service->getAll($getAllRequest);
This for example returns list of all the existing currencies.
回答7:
Maybe this link is helpful : http://tellsaqib.github.io/NSPHP-Doc/df/d09/class_get_all_record_type.html
GetAllRecordType Class don't have InventoryItem
Data Fields
const budgetCategory = "budgetCategory"
const campaignAudience = "campaignAudience"
const campaignCategory = "campaignCategory"
const campaignChannel = "campaignChannel"
const campaignFamily = "campaignFamily"
const campaignOffer = "campaignOffer"
const campaignSearchEngine = "campaignSearchEngine"
const campaignSubscription = "campaignSubscription"
const campaignVertical = "campaignVertical"
const costCategory = "costCategory"
const currency = "currency"
const leadSource = "leadSource"
const salesTaxItem = "salesTaxItem"
const state = "state"
const supportCaseIssue = "supportCaseIssue"
const supportCaseOrigin = "supportCaseOrigin"
const supportCasePriority = "supportCasePriority"
const supportCaseStatus = "supportCaseStatus"
const supportCaseType = "supportCaseType"
const taxGroup = "taxGroup"
const taxType = "taxType"
来源:https://stackoverflow.com/questions/19275153/netsuite-how-to-specify-record-type-for-getall-request