updateItem

This API call updates an existing record in the ExtraView database. Except for the itemId, all fields are treated as optional. However, all defined business rules are executed and checked before and after the record is updated, therefore fields that are required or become required due to the rules must be provided.

Input

Class

Name

Type

Required

Details

UpdateItemRequest

userId

String

Yes

The callers user name

UpdateItemRequest

password

String

Yes

The callers password

UpdateItemRequest

itemId

int

?

The int item id. This field is optional if itemIdStr is given, else it is required. It is recommended that you use itemIdStr

UpdateItemRequest

itemIdStr

String

?

The String item Id. This field is optional if itemId is used. It is recommended that you use itemIdStr

UpdateItemRequest

sendEmail

boolean

Yes

 

UpdateItemRequest

itemFields

Array[]

Yes

 

ItemRecordField

fieldId

String

Yes

 

ItemRecordField

fieldTitle

String

Yes

 

ItemRecordField

fieldValue

String

No

 

ItemRecordField

row

Integer

No

 

Output

Class

Name

Type

Required

Details

UpdateItemResponse

success

boolean

Yes

True is succeeded False if failed

UpdateItemResponse

returnCode

String

No

See Appendix for details

UpdateItemResponse

returnMessage

String

No

Human readable message

UpdateItemResponse

itemId

int

Yes

The int value of the ID of the inserted item

UpdateItemResponse

itemIdStr

String

Yes

The recommended field to obtain the ID of the inserted item

Example

public static void testUpdateItem(EVItemServiceStub stub) {
try {
UpdateItemDocument reqEnvelope = UpdateItemDocument.Factory.newInstance();
UpdateItemRequest request = reqEnvelope.addNewUpdateItem().addNewRequest();
request.setUserId(ServiceClientHelper.ADMIN_USER_ID);
request.setPassword(ServiceClientHelper.ADMIN_PASSWORD);

List items = new ArrayList();
ItemRecordField item = null;
for (int i=0;i item = ItemRecordField.Factory.newInstance();
item.setRow(0); // no repeating rows for this example
switch(i) {
case 0:
item.setFieldId("status");
item.setFieldValue("NEW");
break;
case 1:
item.setFieldId("assigned_to");
item.setFieldValue(ServiceClientHelper.generatedUserId);
break;
case 2:
item.setFieldId("short_description");
item.setFieldValue("This is the short desc or title");
break;
case 3:
item.setFieldId("description");
item.setFieldValue("this is the long desc");
break;
default:
item.setFieldId("unknown");
item.setFieldValue("");
break;
}
items.add(item);
}

request.setItemFieldsArray(items.toArray(new ItemRecordField[items.size()]));
request.setSendEmail(false);

UpdateItemResponseDocument resEnvelope = stub.updateItem(reqEnvelope);
UpdateItemResponse response = resEnvelope.getUpdateItemResponse().getReturn();

if (response.getSuccess()) {
System.out.println("success: [" +
response.getReturnCode() + "] : " +
response.getReturnMessage());
} else {
System.out.println("failure: [" +
response.getReturnCode() + "] : " +
response.getReturnMessage());
}

} catch (Exception e) {
e.printStackTrace();
System.err.println("nnn");
}
}