Creating Step 1: Check Rental Agreement Return Condition Rule

This topic describes how the developer created the VBScript rule to determine whether a vehicle has been checked in and whether it has been marked as damaged.

  1. Place a rule-based step on the Process Flow's Design tab.
  2. In the Properties area, enter the step's Name and enter the step's description on the Description tab:
    • Name: Check Rental Agreement Return Condition
    • Description: Check the Return Condition of the Rental Agreement. Only want to create a Service Ticket if marked as Damaged. 
  3. Click the Rule tab and select VBScript as the Rule Type.
  4. Enter the VBScript that provides the step's logic. Use the Available Objects and references (accessible from the Scripting toolbar) as necessary.
    • See Writing Process Flow Step Rules for more information on writing process flow scripts.
    • The full text of the VBScript for this rule appears below. It performs the following functions:
      • Determines whether the RAObject GE object is empty. If so, the rule selects a Result Code of FAILED.
      • Determines whether the RentalCondition for the RAObject has been set. This is a required field to complete a check-in. So if it blank, the vehicle is checked-out and the rule selects a Result Code of END.
      • If the RentalCondition field is not blank, the rule determines if the field is dirty (that is, if its value changed in the current save transaction).
      • If the field is dirty and its value contains the word "damage", then the rule selects a Result Code of DAMAGED.
      • If the field is dirty and its value does not contain the word "damage", then the rule selects a Result Code of NEXT.
      • Finally, if the rule fails to execute for another reason, the error is captured by Aptify's Exception Manager for logging and the rule selects the Result Code of FAILED.

        If oProperties.GetProperty("RAObject") Is Nothing Then
        oResultCode.Value = "FAILED"
          Dim oRentalAgreementGE As Aptify.Framework.BusinessLogic.GenericEntity.AptifyGenericEntityBase
          oRentalAgreementGE = CType(oProperties.GetProperty("RAObject"), Aptify.Framework.BusinessLogic.GenericEntity.AptifyGenericEntityBase)
                      If oRentalAgreementGE.GetValue("ReturnCondition").ToString = "" Then
                          'This vehicle has not yet been returned. Nothing should be done.
                            oResultCode.Value = "END"
                          'Vehicle is returned, check to see if Service Ticket is required.
                          If oRentalAgreementGE.Fields("ReturnCondition").IsDirty _
                          AndAlso CBool(oRentalAgreementGE.GetValue("ReturnCondition").ToString.Contains("Damage")) Then
                                oResultCode.Value = "DAMAGED"
                                oResultCode.Value = "NEXT"
                          End If
                      End If
         End If
        Catch ex As System.Exception
         oResultCode.Value = "FAILED"
        End Try
  5. Add RAObject as a custom input map to the step's Properties tab.

    • RAObject is one of the Process Flow's Input Properties that is populated by the Event Handler when the event fires. By specifying the input map, the rule can retrieve this object from the Process Flow's Context Object. Therefore, the Source for this Input Property is Context Object and the Source is the RAObject object.

      Rule's Input Map
  6. Save the Process Flows record.
  7. Add Step 2. See Creating Step 2: Create Service Ticket for Damage Step.


You will return later to this step to configure its Action Map (see Linking Sample Process Flow Steps Together). Aptify recommends waiting to configure the Action Map until later since there are no next steps to link to yet. Note that this step does not produce any output values so the Output Map is not configured. 

Was this article helpful?
0 out of 0 found this helpful



Please sign in to leave a comment.