This section describes how an audit trail entity can be created
What does this section cover?
Create a workflow Rule Entity
In order for an entity to be available to Workflow Rules Mechanism, it has to meet the following conditions:
1. Data Object Class
The entity's DO class must implement ICRMDOWorkflowRuleEntity interface and its 28 methods:
- setUserField1(String userField1)
- setUserField2(String userField2)
- setUserField3(String userField3)
- setUserField4(String userField4)
- setUserField5(String userField5)
- setUserField6(String userField6)
- setUserField7(String userField7)
- setUserField8(String userField8)
- setDateTime1(Date dateTime1)
- setDateTime2(Date dateTime2)
- setDateTime3(Date dateTime3)
- setDateTime4(Date dateTime4)
- setFloat1(BigDecimal float1)
- setFloat2(BigDecimal float2)
- setFloat3(BigDecimal float3)
- setFloat4(BigDecimal float4)
- setStatusTransitionExceptionEnabled(Integer statusTransitionExceptionEnabled)
- getStatusTransitionExceptionEnabled()
- isStatusTransitionExceptionEnabled()
- setACRExceptionEnabled(Integer acrExceptionEnabled)
- getACRExceptionEnabled()
- isACRExceptionEnabled()
- setPLARExceptionEnabled(Integer plarExceptionEnabled)
- getPLARExceptionEnabled()
- isPLARExceptionEnabled()
- setOwnedByGroupExceptionEnabled(Integer ownedByGroupExceptionEnabled)
- getOwnedByGroupExceptionEnabled()
- isOwnedByGroupExceptionEnabled()
Note that for any of 1-16 methods there is no corresponding database field, no functionality should be implemented.
In order to implement methods 17-28 the following java transient fields should be declared:
- Integer statusTransitionExceptionEnabled
- Integer acrExceptionEnabled
- Integer plarExceptionEnabled
- Integer ownedByGroupExceptionEnabled
ppublic class CUSTOMCRMDORental extends CRMDO implements ICRMDOWorkflowRuleEntity{
private CUSTOMCRMDORentalType type;
private CUSTOMRentalState state;
private CRMDOAccountReceivable accountReceivable;
private Date effectiveDate;
private Date expirationDate;
private Set<CUSTOMCRMDORentalItem> items;
//transient fields
private Integer statusTransitionExceptionEnabled;
private Integer acrExceptionEnabled;
private Integer plarExceptionEnabled;
private Integer ownedByGroupExceptionEnabled;
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;
}
public CUSTOMCRMDORentalType getType() {
return type;
}
public void setType(CUSTOMCRMDORentalType type) {
setChange("type", this.type, type);
this.type = type;
}
@Override
public void setUserField1(String userField1) {
// TODO Auto-generated method stub
}
@Override
public void setUserField2(String userField2) {
// TODO Auto-generated method stub
}
@Override
public void setUserField3(String userField3) {
// TODO Auto-generated method stub
}
@Override
public void setUserField4(String userField4) {
// TODO Auto-generated method stub
}
@Override
public void setUserField5(String userField5) {
// TODO Auto-generated method stub
}
@Override
public void setUserField6(String userField6) {
// TODO Auto-generated method stub
}
@Override
public void setUserField7(String userField7) {
// TODO Auto-generated method stub
}
@Override
public void setUserField8(String userField8) {
// TODO Auto-generated method stub
}
@Override
public void setDateTime1(Date dateTime1) {
// TODO Auto-generated method stub
}
@Override
public void setDateTime2(Date dateTime2) {
// TODO Auto-generated method stub
}
@Override
public void setDateTime3(Date dateTime3) {
// TODO Auto-generated method stub
}
@Override
public void setDateTime4(Date dateTime4) {
// TODO Auto-generated method stub
}
@Override
public void setFloat1(BigDecimal float1) {
// TODO Auto-generated method stub
}
@Override
public void setFloat2(BigDecimal float2) {
// TODO Auto-generated method stub
}
@Override
public void setFloat3(BigDecimal float3) {
// TODO Auto-generated method stub
}
@Override
public void setFloat4(BigDecimal float4) {
// TODO Auto-generated method stub
}
@Override
public void setStatusTransitionExceptionEnabled(Integer statusTransitionExceptionEnabled) {
this.statusTransitionExceptionEnabled = statusTransitionExceptionEnabled;
}
@Override
public Integer getStatusTransitionExceptionEnabled() {
return this.statusTransitionExceptionEnabled;
}
@Override
public Boolean isStatusTransitionExceptionEnabled() {
return ((this.statusTransitionExceptionEnabled!=null && this.statusTransitionExceptionEnabled.equals(new Integer(1))) ? true : false);
}
@Override
public void setACRExceptionEnabled(Integer acrExceptionEnabled) {
this.acrExceptionEnabled = acrExceptionEnabled;
}
@Override
public Integer getACRExceptionEnabled() {
return this.acrExceptionEnabled;
}
@Override
public Boolean isACRExceptionEnabled() {
return ((this.acrExceptionEnabled!=null && this.acrExceptionEnabled.equals(new Integer(1))) ? true : false);
}
@Override
public void setPLARExceptionEnabled(Integer plarExceptionEnabled) {
this.plarExceptionEnabled = plarExceptionEnabled;
}
@Override
public Integer getPLARExceptionEnabled() {
return this.plarExceptionEnabled;
}
@Override
public Boolean isPLARExceptionEnabled() {
return ((this.plarExceptionEnabled!=null && this.plarExceptionEnabled.equals(new Integer(1))) ? true : false);
}
@Override
public void setOwnedByGroupExceptionEnabled(Integer ownedByGroupExceptionEnabled) {
this.ownedByGroupExceptionEnabled = ownedByGroupExceptionEnabled;
}
@Override
public Integer getOwnedByGroupExceptionEnabled() {
return this.ownedByGroupExceptionEnabled;
}
@Override
public Boolean isOwnedByGroupExceptionEnabled() {
return ((this.ownedByGroupExceptionEnabled!=null && this.ownedByGroupExceptionEnabled.equals(new Integer(1))) ? true : false);
}
}
In entities metadata file, <workflowruleincluded> tag's value must be set to true. Keep in mind that <workflowruleincluded> default value is false.
Also if you want 'Applicable on Entity Types' setting to be available <typeentityid> must be defined as well as the corresponding entity.
In fields metadata file:
- <workflowruleactionincluded> tag's value must be set to true for the fields that you want to be available in 'Update Information' sub-section of 'Actions' section. Keep in mind that <audittrailexcluded> default value is false. (see Image 1)
- <workflowruleconditionincluded> tag can include any of the following values (separated by comma (,) if more than one is to be defined):
- FIELD_CHANGE: When you want the specific field to be available in 'Conditions' section when the condition type is 'When Specific Field Changes' (see Image 2)
- FIELD_CONTAINS_VALUE: When you want the specific field to be available in 'Conditions' section when the condition type is 'When Specific Field Contains Specific Value' (see Image 3)
- FIELD_FROM_TO_VALUE_CHANGE: When you want the specific field to be available in 'Conditions' section when the condition type is 'When Specific Field Changes From A Specific Value To Another Specific Value' (see Image 4)
4. Data Entry Page
If you want any fields to be available in
- 'Update Information' sub-section of 'Actions' section and/or
- 'Conditions' section when the condition type is 'When Specific Field Contains Specific Value' and/or
- 'Conditions' section when the condition type is 'When Specific Field Changes From A Specific Value To Another Specific Value'
workflow rule data entry page must be customised in order for the elements responsible for specifying the field value in the above cases to be created.
For more information on customising data entry pages go to Customize Data Entry Pages.