Custom record types, which are created in the user interface by navigating to Customization > Lists, Records, & Fields > Record Types > New, can also be created via Web Services.
This can be done by performing the add operation with a record of type CustomRecordType. More information about the CustomRecordType record can be found in the SuiteTalk Schema Browser > customization.xsd.
The only mandatory field when setting up a custom record type is the Name field. This value needs to be provided in the Web Services request.
An example of a request creating a custom record type and specifying only its name is the following:
<soapenv:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Body> <add xmlns="urn:messages_2012_1.platform.webservices.netsuite.com"> <record xsi:type="ns1:CustomRecordType" xmlns:ns1="urn:customization_2012_1.setup.webservices.netsuite.com"> <ns1:recordName xsi:type="xsd:string">WS Test Record</ns1:recordName> </record> </add> </soapenv:Body></soapenv:Envelope>
The relevant Java code used for this example can be seen in the following snippet:
CustomRecordType custRec = new CustomRecordType();//set the custom record type's namecustRec.setRecordName("WS Test Record");//perform the add operationWriteResponse custRecResp = port.add(custRec);
Note: Custom fields can be created for the custom record type only after the record type has been already created. More information about this can be found in SuiteAnswers : Custom Record Custom Field (Article Id: 10901).
No comments:
Post a Comment