Create a Workflow Rule Entity

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: 

  1. setUserField1(String userField1)
  2. setUserField2(String userField2)
  3. setUserField3(String userField3)
  4. setUserField4(String userField4)
  5. setUserField5(String userField5)
  6. setUserField6(String userField6)
  7. setUserField7(String userField7)
  8. setUserField8(String userField8)
  9. setDateTime1(Date dateTime1)
  10. setDateTime2(Date dateTime2)
  11. setDateTime3(Date dateTime3)
  12. setDateTime4(Date dateTime4)
  13. setFloat1(BigDecimal float1)
  14. setFloat2(BigDecimal float2)
  15. setFloat3(BigDecimal float3)
  16. setFloat4(BigDecimal float4)
  17. setStatusTransitionExceptionEnabled(Integer statusTransitionExceptionEnabled)
  18. getStatusTransitionExceptionEnabled()
  19. isStatusTransitionExceptionEnabled()
  20. setACRExceptionEnabled(Integer acrExceptionEnabled)
  21. getACRExceptionEnabled()
  22. isACRExceptionEnabled()
  23. setPLARExceptionEnabled(Integer plarExceptionEnabled)
  24. getPLARExceptionEnabled()
  25. isPLARExceptionEnabled()
  26. setOwnedByGroupExceptionEnabled(Integer ownedByGroupExceptionEnabled)
  27. getOwnedByGroupExceptionEnabled()
  28. 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:

  1. Integer statusTransitionExceptionEnabled
  2. Integer acrExceptionEnabled
  3. Integer plarExceptionEnabled
  4. Integer ownedByGroupExceptionEnabled

CUSTOMCRMDORental
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);
	}	
}

2. Entities Metadata File

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.

3. Fields Metadata file

In fields metadata file:

    1. <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)
    2. <workflowruleconditionincluded> tag can include any of the following values (separated by comma (,) if more than one is to be defined):
      1. 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)
      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)
      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

  1. 'Update Information' sub-section of 'Actions' section and/or
  2.  'Conditions' section when the condition type is 'When Specific Field Contains Specific Value' and/or
  3. '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.