Show/Hide Toolbars

The following sample updates a history record. Prerequisite to working with history records, you must also get the unique key value for the history record to update. If the history record is associated with another record, you need to get that record's unique key

Code Snippet

Date date = new Date();

protected HistoryRepository historyRepository;

historyRepository.updateHistory(history);

private void updateHistory() {

HistoryUpdate history = new HistoryUpdate();

//use setUniqueKey to identify the target history record to update

history.setUniqueKey("HIST_0011");

history.setShortDescription("Subject - Update contact phone number");

history.setText("Additional information about the contact record update");

history.setArchivedOn(date);

Category cat = new Category();

//the next two lines identify a category and then add the category to the history record

cat.setUniqueKey("HIST_MANA");

history.getCategories().add(cat);

//use the parentObject property to associate the history with an existing record by unique key, for example, to describe a contact record that you have recently modified

history.setParentObject("CONT_1234");

return history;

}