Calculating whether to add a trade license fee

You can use an AddOnCondition formula to calculate whether a fee is added to a license. For example, you could write a formula that adds an extra handling fee for any master-level licenses.

AddOnCondition formulas use the oTradeLicense object (an instance of the Hansen.CDR.TradeLicense.iTradeLicense class) to set AddOnCondition to either True or False.

You can also use properties and methods of the Fee object in your formula. For example, you might want to specify the fee types that the formula applies to. To access fee properties, select the Fee node under TradeLicenseSignature in the Methods and Properties tree. You must also use the AssociatedRecordType node to indicate the type of record (AssociatedRecordType.Fee).

For more information, and for sample code, click the Information tab in the Formula Editor.

Examples

This formula adds a fee if the license is in the Plumbing license category:


AddOnCondition = False
If oTradeLicense.LicenseCategory.Code.ToUpper = "PLUMB" Then
  AddOnCondition = True
End If

This formula adds a fee if there is nothing recorded for the license's location:


AddOnCondition = False
If oTradeLicense.Location="" Then
  AddOnCondition = True
End If

This formula adds a fee if there are any employees associated with the license:


AddOnCondition = False
If oTradeLicense.LicenseEmployees.Count > 0 Then
  AddOnCondition = True
End If