• No results found

Important:

This operation has been removed as of WSDL version 2010.1. If you choose to upgrade to the 2010.1 or later WSDL, you must update existing

getCustomization code to use the getCustomizationId operation. Note that getCustomization will continue to be supported in WSDL versions 2009.2 and older.

Because any record in NetSuite can be fully customized to suit the needs of a given business, it is critical to consider these customizations when developing generic Web services applications. Use the getCustomization operation to dynamically retrieve and manage the metadata for custom fields, custom lists, and custom record types in order to handle custom business logic that may be included at the record level.

The following are the custom objects currently supported by the getCustomization operation. These are enumerated in the coreTypes XSD.

crmCustomField

customList

customRecordType

entityCustomField

itemCustomField

itemOptionCustomField

otherCustomField

transactionBodyCustomField

transactionColumnCustomField

Note:

Normally, you cannot add or update the internalId of a NetSuite object. Custom objects, however, are an exception to this rule. You can specify the ID on add, but you cannot update the ID thereafter. Also note that internalIds for custom objects can be set to any unique alphanumeric string up to 30 characters long. This string must not include any spaces but can include underscores ( _ ).

Web Services Operations

getCustomization

146

Request

The getCustomizationRequest type is used for this request. It contains the following fields:

Response

The getCustomizationResult type is used for the Response. It contains the following fields:

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 <soap:Body> <platformMsgs:getCustomization> <platformMsgs:customizationType getCustomizationType="crmCustomField"/> </platformMsgs:getCustomization> </soap:Body> </soap:Envelope>

Element Name XSD Type Notes customizationType CustomizationT

ype

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 records for this search. Depending on the pageSize value, some or all the records may be returned in this response

recordList Record[] A list of records that correspond to the specified customization type.

SOAP Response <soapenv:Body> <getCustomizationResponse xmlns="urn:messages_2_0.platform.webservices.netsuite.com"> <getCustomizationResult xmlns="urn:core_2_5.platform.webservices.netsuite.com"> <status isSuccess="true"/> <totalRecords>1</totalRecords> <recordList>

<record internalId="CUSTEVENT1" xsi:type="ns1:CrmCustomField" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns1="urn:customization_2_5.setup.webservices.netsuite.com"> <ns1:label>test</ns1:label> <ns1:fieldType>_freeFormText</ns1:fieldType> <ns1:storeValue>true</ns1:storeValue> <ns1:showInList>false</ns1:showInList> <ns1:isParent>false</ns1:isParent> <ns1:displayType>_normal</ns1:displayType> <ns1:isMandatory>false</ns1:isMandatory> <ns1:defaultChecked>false</ns1:defaultChecked> <ns1:isFormula>false</ns1:isFormula> <ns1:appliesToTask>false</ns1:appliesToTask> <ns1:appliesToPhoneCall>false</ns1:appliesToPhoneCall> <ns1:appliesToEvent>false</ns1:appliesToEvent> <ns1:appliesToCase>false</ns1:appliesToCase> <ns1:appliesToCampaign>false</ns1:appliesToCampaign> <ns1:appliesPerKeyword>false</ns1:appliesPerKeyword> <ns1:appliesToSolution>false</ns1:appliesToSolution> <ns1:availableExternally>false</ns1:availableExternally> </record> </recordList> </getCustomizationResult> </getCustomizationResponse> </soapenv:Body> Java Sample 1 port.getCustomization(new CustomizationType(GetCustomizationType.transactionBodyCustomField)); Java Sample 2

public void getCustomization()throws RemoteException {

this.login(true);

CustomizationType ct = new CustomizationType(GetCustomizationType.customRecordType); GetCustomizationResult response = _port.getCustomization(ct);

boolean success = response.getStatus().isIsSuccess(); if (success)

{

RecordList recList = response.getRecordList(); int len = recList.getRecord().length;

CustomRecordType[] crt = new CustomRecordType[len]; for (int i = 0; i < len; i++)

{

crt[i] = (CustomRecordType)recList.getRecord()[i];

_console.writeLn("Record: " + crt[i].getRecordName() + " " + crt[i].getInternalId()); }

Web Services Operations

getCustomization

148

}

C# Sample

private void getCustomization() {

this.login(true);

CustomizationType ct = new CustomizationType();

ct.getCustomizationType = GetCustomizationType.customRecordType; ct.getCustomizationTypeSpecified = true;

GetCustomizationResult response = _service.getCustomization(ct); if (!response.status.isSuccess)

Console.WriteLine("ERROR: addRigLocation - no records found"); else

{

CustomRecordType[] rl = null;

rl = new CustomRecordType[response.recordList.Length]; for (int i = 0; i < response.recordList.Length; i++) {

rl[i] = (CustomRecordType)response.recordList[i];

Console.WriteLine("Record: " + rl[i].recordName + " " +rl[i].internalId); } } } PHP Sample require_once '../PHPtoolkit.php'; require_once 'login_info.php'; global $myNSclient;

# GETCUSTOMIZATION ON ITEM CUSTOM FIELDS # ===============

//set the getCustomizationType (i.e crmCustomField, customList, customRecordType, //entityCustomField, itemCustomField, itemOptionCustomField, otherCustomField, //transactionBodyCustomField, transactionColumnCustomField)

$getCustomizationType = 'itemCustomField'; // perform getCustomization operation

$getCustomizationResponse = $myNSclient->getCustomization($getCustomizationType); // handle response

if (!$getCustomizationResponse->isSuccess) {

echo "<font color='red'><b>" . $getCustomizationResponse->statusDetail[0]->message . "</b></font>"; } else {

The above code would generate the following SOAP request for the getCustomization request: <Body> <getCustomization> <customizationType getCustomizationType="itemCustomField" /> </getCustomization> </Body>

getCustomizationId

When integrating with NetSuite through Web services, in many cases, you will want to know which custom objects exist in an account. You may also want to obtain metadata for these custom objects so that your application can handle any business logic that is specific to the account.

To learn which custom objects exist in an account, use the getCustomizationId operation to retrieve the internalIds, externalIds, and/or scriptIds of all custom objects of a specified type. These types, enumerated in CustomizationType, include the following:

crmCustomField

customList

customRecordType

entityCustomField

itemCustomField

itemOptionCustomField

otherCustomField

transactionBodyCustomField

transactionColumnCustomField

Note:

The CustomizationType object is defined in the coreTypes XSD.

Once the IDs are returned, you can then pass the ID value(s) to either the get or getList operation to obtain metadata for specific custom objects (see Using get and getList with getCustomizationId for more details). If you are returning large sets of metadata, the getCustomizationId operation allows you to add pagination to break your response into multiple pieces.

Notes:

To see the UI equivalent of a NetSuite custom object, go to Setup > Customization > Lists, Records, & Fields > [custom object type]. For information on working with each object type in Web services, see SuiteBuilder Overview in the NetSuite Help Center. For a more general understanding of the NetSuite customization model, refer to the

SuiteBuilder (Customization) Guide, also in the NetSuite Help Center.

Normally, you cannot add or update the internalId of a NetSuite object. Custom objects, however, are an exception to this rule. You can specify the ID on add, but you

Web Services Operations

getCustomizationId

150

cannot update the ID thereafter. Also note that internalIds for custom objects can be set to any unique alphanumeric string up to 30 characters long. This string cannot include any spaces, but it can include underscores ( _ ).