Developer Q&A

Ask a Question
Back to All

Error using CreateCommand for a WoNote (Java)

This is a POC so I am hard coding the values so I know exactly what they are. I know I am populating the WorkOrder ID but I get this error in the CommandResponse:

Cannot insert the value NULL into column 'WorkOrderID', table 'IfmRestoration.dbo.WONote2Object'; column does not allow nulls. INSERT fails.
The statement has been terminated.

Here is the code:
WoNote woNote = new WoNote();
woNote.setNoteTypeId(WONoteType.Public);
woNote.setCreatedDate(Calendar.getInstance());
Integer woINT = Integer.valueOf(aJNote.getString("woid"));
woNote.setWorkOrderId(woINT.intValue());
woNote.setBody(aJNote.getString("body"));
CreateCommand uc = new CreateCommand(woNote);
CommandResponse cr = this.getcService().execute(uc);
System.out.println(cr.getErrorInfo().getDescription());