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: Update JE line list item using suitetalk api

This is the issue while updating the line list item.
You do not have permissions to set a value for element line.line due to one of the following reasons:
1) The field is read-only;
2) An associated feature is disabled;
3) The field is available either when a record is created or updated, but not in both cases.
I tried many things as per the googling. Like checked the roles and accessibility. Dealing with this issue from last week. And line field is standard field generated by the NetSuite sandbox. Able to add/update the JE line list item using GUI. And status of JE is "Approved for Posting". If you have any idea about it please share with me.

web-service x 18
netsuite x 17
Posted On : 2017-11-20 22:09:36.0
profile ALOK binwal - anyforum.in ALOK binwal
300
up-rate
3
down-rate

Answers


Update:
------------------------------
The update operation is used to update an instance of a record in NetSuite. It is similar to the updateList operation, which allows users to update more than one record at a time.

Updating Record Lists:
----------------------------------------------------------
When updating a list of records (a sublist) within a business record you can NOT update a specific item in the list. Instead you must interact with the sublist as a whole.

updateList:
------------------------------------------
The updateList operation is used to update one or more instances of a record type in NetSuite. If there are multiple records, they can either be of the same record type or different record types. For example, it´s possible to update a customer and a contact within a single request using this operation.


Important:
-------------------------------------
* Only the fields that have been populated in each submitted record are updated in the system. If a field has not been populated, it is not updated in the system and it retains its previous value. If a field is set to an empty string, the previous value of the field is replaced with an empty string. Therefore, when updating records, it is recommended that you get the desired record, instantiate a new record of the same type, populate only the fields that require an update and then submit the updated record. This ensures that only the fields requiring an update are written on submission.

* Calculated and hidden fields in records are always updated by the system unless your service explicitly overrides the system values.

* Also, custom fields can only be set to NULL by submitting the field in nullFieldList.

* To ensure that the most recent data for a given record is being modified, when a Web service request is received, the values for that record are retrieved at the time of the Update request rather than with the initial Get of the associated record. The record is then updated by the values submitted in the request. It is possible that between the time of the retrieval of the record field values and the submission of the updated fields that the record is altered from another source (for example from a UI submission). In this case an error message is returned to indicate that the fields have been modified since your service retrieved the record.

* Although records of a particular type may be used in multiple integration scenarios, each record instance can only have a single external ID value. In order to maintain data integrity, only a single integrated application can set and update external ID values for each record type. External ID values for all records of a particular type must all come from the same external application.


Java Sample Code for updateList:
------------------------------------------------------------
public void updateCustomerList() throws RemoteException,
ExceededUsageLimitFault, UnexpectedErrorFault, InvalidSessionFault,
ExceededRecordCountFault {
// This operation requires a valid session
this.login(true);
// Prompt for list of nsKeys and put in an array
_console
.write("\nEnter nsKeys for customer records to be updated (separated by commas): ");
String reqKeys = _console.readLn();
String[] nsKeys = reqKeys.split(",");
// Create an array of Record objects to hold the customers
Record[] records = new Record[nsKeys.length];
// For each submitted nsKey, populate a customer object
for (int i = 0; i < nsKeys.length; i++) {
Customer customer = new Customer();
// Update name
customer.setEntityId("XYZ Inc " + i);
customer.setCompanyName("XYZ, Inc. " + i);
customer.setInternalId(nsKeys[i].trim());
records[i] = customer
}
// Invoke updateList() operation to update customers
WriteResponseList responseList = _port.updateList(records);
// Process responses for all successful updates
WriteResponse[] responses = responseList.getWriteResponse();
boolean hasFailures = false;
_console.info("\nThe following customers were updated successfully:");
for (int i = 0; i < responses.length; i++) {
if ((responses[i] != null)
&& (responses[i].getStatus().isIsSuccess())) {
_console.info("\nCustomer[" + i + "]:");
_console.info("key="
+ ((RecordRef) responses[i].getBaseRef()).getInternalId()
+ "\nentityId="
+ ((Customer) records[i]).getEntityId()
+ "\ncompanyName="
+ ((Customer) records[i]).getCompanyName());
} else {
hasFailures = true;
}
}
// Process responses for all unsuccessful updates
if (hasFailures) {
_console.info("\nThe following customers were not updated:\n");
for (int i = 0; i < responses.length; i++) {
if ((responses[i] != null)
&& (!responses[i].getStatus().isIsSuccess())) {
_console.info("Customer[" + i + "]:");
_console.info("key="
+ ((RecordRef) responses[i].getBaseRef()).getInternalId());
_console.errorForRecord(getStatusDetails(responses[i]
.getStatus()));
}
}
}
}

Posted On : 2017-11-21 22:06:24
Satisfied : 0 Yes  0 No
profile Rishi Kumar - anyforum.in Rishi Kumar
523185418912
Reply This Thread
up-rate
0
down-rate



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