Netsuite - how to specify record_type for getall request

六眼飞鱼酱① 提交于 2019-12-04 12:02:00

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

inventoryItem, not InventoryItem.

Also, what language are you using? If PHP, there is a PHPToolkit to help you out.

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.

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)

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.

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.

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"

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!