This section describes how an audit trail entity can be created
What does this section cover?
Create an Audit Trail Entity
In order for an entity to be monitored by the Audit Trail Mechanism, it has to meet the following conditions:
1. Data Object Class
The entity's DO class must implement ICRMDOAuditTrailedEntity interface and its two methods: getAuditTrailLogs() and setAuditTrailLogs(Set<CRMDO> auditTrailLogs). Keep in mind that auditTrailLogs set is defined in superclass CRMDO.
public class CUSTOMCRMDORental extends CRMDO implements ICRMDOAuditTrailedEntity {
private CUSTOMCRMDORentalType type;
private CUSTOMRentalState state;
private CRMDOAccountReceivable accountReceivable;
private Date effectiveDate;
private Date expirationDate;
private Set<CUSTOMCRMDORentalItem> items;
public CUSTOMCRMDORentalType getType() {
return type;
}
public void setType(CUSTOMCRMDORentalType type) {
setChange("type", this.type, type);
this.type = type;
}
public CUSTOMRentalState getState() {
return state;
}
public void setState(CUSTOMRentalState state) {
setChange("state", this.state, state);
this.state = state;
}
public CRMDOAccountReceivable getAccountReceivable() {
return accountReceivable;
}
public void setAccountReceivable(CRMDOAccountReceivable accountReceivable) {
setChange("accountReceivable", this.accountReceivable, accountReceivable);
this.accountReceivable = accountReceivable;
}
public Date getEffectiveDate() {
return effectiveDate;
}
public void setEffectiveDate(Date effectiveDate) {
setChange("effectiveDate", this.effectiveDate, effectiveDate);
this.effectiveDate = effectiveDate;
}
public Date getExpirationDate() {
return expirationDate;
}
public void setExpirationDate(Date expirationDate) {
setChange("expirationDate", this.expirationDate, expirationDate);
this.expirationDate = expirationDate;
}
public Set<CUSTOMCRMDORentalItem> getItems() {
return items;
}
public void setItems(Set<CUSTOMCRMDORentalItem> items) {
setChange("items", this.items, items);
this.items = items;
}
@Override
public Set<CRMDO> getAuditTrailLogs() throws Exception {
return auditTrailLogs;
}
@Override
public void setAuditTrailLogs(Set<CRMDO> auditTrailLogs) throws Exception {
this.auditTrailLogs=auditTrailLogs;
}
}
In entities metadata file, <audittrailexcluded> tag's value must be set to false. Keep in mind that <audittrailexcluded> default value is false, so in such cases, it can be omitted.
In fields metadata file, <audittrailexcluded> tag's value must be set to false for the fields that you want to be available for monitoring. Keep in mind that <audittrailexcluded> default value is false, so in such cases, it can be omitted.