Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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

  1. Place a rule-based step on the Process Flow's Design tab.
    • See

...

...

    •  for more information on adding steps to the process flow.
  1. 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.
       
  2. Click the Rule tab and select VBScript as the Rule Type.
  3. Enter the VBScript that provides the step's logic. Use the Available Objects and references (accessible from the Scripting toolbar) as necessary.
    • See

...

...

    •  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.

...



      • Code Block
        languagevb
        Try

...

      • 
        If oProperties.GetProperty("RAObject") Is Nothing Then

...

      • 
        oResultCode.Value = "FAILED"

...

      • 
         Else
          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"

...

      • 
                      Else
                          '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"

...

      • 
                          Else
                                oResultCode.Value = "NEXT"

...

      • 
                          End If
                      End If
         End If
        Catch ex As System.Exception
         oResultCode.Value = "FAILED"
         Aptify.Framework.ExceptionManagement.ExceptionManager.Publish(ex)

...

      • 
        End Try
  1. 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
  • Save the Process Flows record.
  • Add Step 2. See "Create Step 2: Create Service Ticket for Damage Step" on page 435.Tip: You will return later to this step to configure its Action Map (see "Link Steps Together" on page 447). 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.