• No results found

Getting Dependent Select Values

The getSelectValue operation can also be used to get select values that are available on the condition of other field values. For example, in OneWorld accounts the values that appear in many dropdown fields are based on the values specified for either Customer or Subsidiary. As another example, on the Item sublist of a Sales Order, the values for the Tax Code field depend on both customer and item values.

In your getSelectValue call, you will use the GetSelectFilterByFieldValueList and

GetSelectFilterByFieldValue objects to specify the filterBy field of a dependent field. (The dependent field is the field you want to get the values for. The filterBy field is the field that controls which values are available for the dependent field.)

<complexType name="GetSelectFilterByFieldValueList"> <sequence>

<element name="filterBy" type="platformCore:GetSelectFilterByFieldValue" minOccurs="1" maxOccurs="unbounded"/>

</sequence> </complexType>

<complexType name="GetSelectFilterByFieldValue"> <sequence>

<element name="sublist" type="xsd:string" minOccurs="0" maxOccurs="1"/> <element name="field" type="xsd:string" minOccurs="1" maxOccurs="1"/> <element name="internalId" type="xsd:string" minOccurs="1" maxOccurs="1"/> </sequence>

</complexType>

The sublist, field, and internalId arguments will contain:

the name of the sublist the filterBy field appears on (if it appears on a sublist)

the schema name of the filterBy field (for example, “entity”)

the internalId of the specific entity record (for example, “87”)

A getSelectValue call for a dependent field with no filterBy (“master”) field specified returns 0 records. This type of call also returns a warning that notes the filterBy field, so the call can be corrected.

Important:

Currently there is no programmatic way to discover what the filterBy field is for another field. Note, however, on transaction records the Customer (entity) field is always the filterBy field for any dependent RecordRef field. For all other record types, you must use the UI to see which field is the filterBy field.

Request

The getSelectValueRequest type is used for the request. It contains the following elements.

GetSelectValueFieldDescription

Element Name XSD Type Notes fieldDescription GetSelectValueField

Description

Use to specify all characteristics of the field containing the select values. For example, depending on the field and the values you want returned, you will specify the names or internalIds for the record type, sublist, and field. You may also specify filtering criteria to refine the select options returned in the response. pageIndex xsd: int For select values that span multiple pages, use this argument to

specify which page to return in your response.

Element Name XSD Type Notes

recordType RecordType Specify a record defined in coreTypes.xsd.

customRecordType RecordRef If you are getting select values for a field appearing on a custom record, specify the internal or external ID of the custom record, as well as the custom record type. sublist xsd:string If getting select values for a field on a sublist, you must

specify the sublist name (as it is defined in the schema). Sublist names are those names that appear toward the bottom of a record schema and are appended with List, for example itemList, saleTeamList, timeList.

field xsd:string Specify a field name, as defined in the schema for that record. The field value can represent either a body field or a sublist field.

customForm RecordRef If the RecordRef or CustomRecordRef field is associated with a custom form, specify the internal or external ID of the custom form, as well as the custom form type.

Web Services Operations

getSelectValue

180

Response

The getSelectValueResponse type is used for the response. It contains the following elements. filter GetSelectValueFilter If you choose, you can filter select options using the

contains, is, or startsWith operator. Use any of these operators to return a subset of the options associated with the RecordRef or CustomRecordRef field.

For example, to get a specific list of customers on an opportunity record, you can search for “Adam” with the

contains operator to get only customers whose name contains Adam.

See also Filtering Select Value Text. filterByValueList GetSelectFilterByField

ValueList

This will contain a reference to the filterBy field (or fields) in which you specify the following:

sublist – If the filterBy field is on a sublist, you will specify the name of the sublist containing this field. Sublist names are appended with List (for example itemList).

field – The name of the filterBy field (for example, entity

or subsidiary).

internalId – The internalId value of the filterBy field (for example, “87” or “112”). If the filterBy field on an Opportunity record is Customer, you would specify:

sublist = null field = “entity”

internalId = “87” (87 being the internalId of a specific customer record, such as the Abe Simpson customer record)

See also Getting Dependent Select Values.

Element Name XSD Type Notes

status Status The status for this operation. All applicable errors or warnings are listed within this type.

totalRecords xsd:int The total number of record references for this search. Depending on the pageSize value, some or all the references may be returned in the response.

totalPages xsd:int The total number of pages for this search. Depending on the pageSize value, some or all the pages may be returned in this response.

baseRefList BaseRef[] An array of baseRefs that references existing NetSuite records, including custom records. These baseRefs represent the valid values available for the current field.

Faults

This operation can throw one of the following faults. See SOAP Fault Status Codes for more information on faults.

InvalidSessionFault

InvalidCredentialsFault

ExceededRequestLimitFault

ExceededUsageLimitFault

ExceededRecordCountFault

ExceededRequestSizeFault

UnexpectedErrorFault

Sample Code

SOAP Request

<?xml version="1.0" encoding="UTF-8"?><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>

<ns1:passport soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xmlns:ns1="urn:messages_2009_2.platform.webservices.netsuite.com"> <ns2:email xmlns:ns2="urn:core_2009_2.platform.webservices.netsuite.com">[email protected]< ns2:email> <ns3:password xmlns:ns3="urn:core_2009_2.platform.webservices.netsuite.com">mypassword< ns3:password> <ns4:account xmlns:ns4="urn:core_2009_2.platform.webservices.netsuite.com">000071</ns4:account <ns5:role internalId="3" xmlns:ns5="urn:core_2009_2.platform.webservices.netsuite.com"/>

</ns1:passport> </soapenv:Header> <soapenv:Body> <getSelectValue xmlns="urn:messages_2009_2.platform.webservices.netsuite.com"> <fieldDescription> <ns6:recordType xmlns:ns6="urn:core_2009_2.platform.webservices.netsuite.com">salesOrder< ns6:recordType> <ns7:sublist xmlns:ns7="urn:core_2009_2.platform.webservices.netsuite.com">itemList</ns7:sublist> <ns8:field xmlns:ns8="urn:core_2009_2.platform.webservices.netsuite.com">item</ns8:field> <ns9:filterByValueList xmlns:ns9="urn:core_2009_2.platform.webservices.netsuite.com"> <ns9:filterBy> <ns9:field>entity</ns9:field> <ns9:internalId>8</ns9:internalId> </ns9:filterBy> </ns9:filterByValueList> </fieldDescription> <pageIndex>1</pageIndex> </getSelectValue> </soapenv:Body> </soapenv:Envelope>

Web Services Operations

getSelectValue

182

Java

This sample shows how get select values for the Item field that appears on the Item sublist of a Sales Order record.

GetSelectFilterByFieldValueList myFilterByList = new GetSelectFilterByFieldValueList(new GetSelectFilterByFieldValue[]{new GetSelectFilterByFieldValue(null,"entity","8")});

GetSelectValueFieldDescription myGSVField = new GetSelectValueFieldDescription(RecordType.salesOrder, null, "itemList", "item", null, null, myFilterByList);

getServerTime

This operation takes no arguments and returns the NetSuite server time in GMT, regardless of a user’s time zone. Developers do not have to rely on client time when writing synchronization procedures because the client time may not be in synch with the NetSuite server time.

If you choose, you can write client code that takes the GMT returned by NetSuite and convert the time to your local time zone. The format of the dateTime value returned by getServerTime contains integer-valued year, month, day, hour and minute properties, a decimal-valued second property and a boolean time-zoned property (timestamp) – for example, 2005-09-

21T15:24:00.000-07:00, where 2005-09-21 is the date, 15:24:00.000 is the time and -07:00 is your own time zone offset, if you choose to set one.

Any user with an active session can call getServerTime. There are no explicit permissions for this operation. For example, if you need to synchronize customer data with NetSuite, you can call getServerTime to initialize your synchronization process. To synchronize new or changed customers records, you can search customers and filter by lastModifiedDate using the value returned in getServerTime. To synchronize deleted customer records, you can call the getDeleted operation and use the value returned in getServerTime. This makes your

synchronization process independent of your client time,which may not be in sync with the NetSuite server time and hence the timestamp we use to track changes.

Request

The GetServerTimeRequest type is used for the request. It takes no arguments.

Response

The GetServerTimeResponse type is used for the response. It contains the following elements.

GetServerTimeResult

The GetServerTimeResult type contains the following elements. Element Name XSD Type Notes

response GetServerTime Result

See GetServerTimeResult, below.

Element Name XSD Type Notes

status Status The status for this request. All applicable errors or warnings will be listed within this type, which is defined in the platformCore XSD.

Web Services Operations