insertItem

This API call inserts a new record into the ExtraView database. All fields are treated as optional, and all defined business rules are executed and checked before and after the record is inserted.

Input

Class

Name

Type

Required

Details

InsertItemRequest

userId

String

Yes

The callers user name

InsertItemRequest

password

String

Yes

The callers password

InsertItemRequest

sendEmail

boolean

Yes

 

InsertItemRequest

itemFields

Array[]

Yes

An array of ItemRecordField objects

ItemRecordField

fieldId

String

Yes

 

ItemRecordField

fieldTitle

String

Yes

 

ItemRecordField

fieldValue

String

No

 

ItemRecordField

row

int

No

 

Output

Class

Name

Type

Required

Details

InsertItemResponse

success

boolean

Yes

True is succeeded False if failed

InsertItemResponse

returnCode

String

No

See Appendix for details

InsertItemResponse

returnMessage

String

No

Human readable message

InsertItemResponse

itemId

String

Yes

The Id of the insertd item

Example

public static void testInsertItem(EVItemServiceStub stub) {
try {
InsertItemDocument reqEnvelope = InsertItemDocument.Factory.newInstance();
InsertItemRequest request = reqEnvelope.addNewInsertItem().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);

InsertItemResponseDocument resEnvelope = stub.insertItem(reqEnvelope);
InsertItemResponse response = resEnvelope.getInsertItemResponse().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");
}
}