AF
HomeTagSubmit NotesAsk AnythingLoginSubscribe Us
AF
1. Feel Free to ask and submit anything on Anyforum.in and get satisfactory answer
2. Registration is not compulsory, you can directly login via google or facebook
3. Our Experts are looking for yours ?.



web-service-netsuite: Netsuite Customer Field Update

i have created the saved search for customer data which consist of 4 million data . I need to update the one of the field. Except Csv import which is better way to update the fields, Schedule script or web services. Please share the code

web-service x 18
netsuite x 17
Posted On : 2016-11-09 16:54:37.0
profile Vk - anyforum.in Vk
300
up-rate
3
down-rate

Answers


Each record in NetSuite is uniquely identified by its record type in combination with either a system-generated NetSuite internal ID or an external ID that has been provided at the time of record creation or during an update. Internal and external IDs are NOT unique across different record types. Therefore, both the record type and either the internal ID or the external ID are required to perform an operation on an existing record, and both are returned for each record in all operations on records.

Note:
---------------------------
Internal IDs are not reused in the system. Once an internal ID has been assigned, if the associated record is subsequently deleted, the ID is not reused.
The term reference or ref is used to define a reference to any existing record (record type/ID combination) in the system. References are implemented through the RecordRef type, which is defined in the following XSD:
https://webservices.netsuite.com/xsd/platform/v2011_1_0/core.xsd


The RecordRef type is described by three attributes -- the internal ID, external ID, and the type:
<complexType name="RecordRef ">
<complexContent>
<extension base="platformCore:BaseRef ">
<attribute name="internalId" type="xsd:string"/>
<attribute name="externalId" type="xsd:string"/>
<attribute name="type" type="platformCoreTyp:RecordType"/>
</extension>
</complexType>

Important: When referencing records, you must provide the internalId or the externalId attribute for all update operations, but not both in the same operation. If both are provided, the internalId is used to locate the record and the externalId is ignored.

Example Java:
----------------------------------
public void updateCustomer() throws RemoteException,
ExceededUsageLimitFault, UnexpectedErrorFault, InvalidSessionFault,
ExceededRecordCountFault {
// This operation requires a valid session
this.login(true);
Customer customer = new Customer();
// Get nsKey for update
_console.write("\nEnter nsKey for customer record to be updated : ");
customer.setInternalId(_console.readLn().toUpperCase());
// Set name and email
customer.setEntityId("XYZ 2 Inc");
customer.setCompanyName("XYZ 2, Inc.");
customer.setEmail("bsanders@xyz.com");
// Populate the address. Updating a list through WS results in the
// entire contents of the previous list being replaced by the new
// list.
CustomerAddressbook address = new CustomerAddressbook();
address.setDefaultBilling(Boolean.TRUE);
address.setDefaultShipping(Boolean.FALSE);
address.setLabel("Billing Address");
address.setAddr1("4765 Sunset Blvd");
address.setCity("San Mateo");
address.setState(?CA?);
address.setCountry(Country._unitedStates);
// Attach the address to the customer
CustomerAddressbookList addressList = new CustomerAddressbookList();
CustomerAddressbook[] addresses = new CustomerAddressbook[1];
addresses[0] = address;
addressList.setAddressbook(addresses);
customer.setAddressbookList(addressList);
// Invoke add() operation
WriteResponse response = _port.update(customer);
// Process the response
Web Services Operations
updateList
247
SuiteTalk Platform Guide
if (response.getStatus().isIsSuccess()) {
_console.info("\nThe following customer was updated successfully:"
+ "\nkey="
+ ((RecordRef) response.getBaseRef()).getInternalId()
+ "\nentityId="
+ customer.getEntityId()
+ "\ncompanyName="
+ customer.getCompanyName()
+ "\nemail="
+ customer.getEmail()
+ "\naddressbookList[0].label="
+ customer.getAddressbookList().getAddressbook(0)
.getLabel());
} else {
_console.error(getStatusDetails(response.getStatus()));
}
}

Posted On : 2016-11-12 21:18:11
Satisfied : 0 Yes  0 No
profile Rishi Kumar - anyforum.in Rishi Kumar
523188221961
Reply This Thread
up-rate
3
down-rate



Post Answer
Please Login First to Post Answer: Login login with facebook - anyforum.in