<?xml version="1.0" encoding="utf-8"?>
  <finScript version="1.00" exportedUtcDate="2024-01-03T03:14:09.0000000">
    <CreatedUserId>ADMIN</CreatedUserId>
    <CreatedUtcDate>2022-12-13T00:55:08.6670000</CreatedUtcDate>
    <UpdatedUserId>ADMIN</UpdatedUserId>
    <UpdatedUtcDate>2024-01-03T03:13:46.8030000</UpdatedUtcDate>
    <ScriptId>HWSL</ScriptId>
    <Description>Service Log</Description>
    <ScriptType>HtmlWidget</ScriptType>
    <Active>true</Active>
    <AllowUI>false</AllowUI>
    <Bookmarks />
    <Category />
    <Code>' HtmlWidget_ServiceLog
Option Explicit On
Option Strict On

' #################################################################
' Service Log form
'
' Version: 1.06 (03/01/2024)
'
' Usage: System-defined HTML Widget
' #################################################################
' Version        Date  User     Job       Description
' -------  ----------  -------  --------  -------------------------
'    1.00  20/12/2021  ISS      J027649   Created
'    1.01  17/06/2022  ISS      J028983   Updated obsoleted functions
'    1.02  16/09/2022  ISS      J029431   Added "Page" Parameter and functionality
'    1.03  13/12/2022  ISS      J030176   Add Comment note
'    1.04  21/03/2023  ISS      J030437   Audit details incorrectly displaying UTC date
'          17/05/2023  ISS      J030916   Handled additional page parameters ('Bank Account Enquiry')
'    1.05  23/08/2023  ISS      J031870   Add additional "Service" page types
'          24/08/2023  ISS      J030201   "PPSR*" PageId now supported
'    1.06  03/01/2024  ISS      J032686   Remove references to GlobalTestMode
' #################################################################

' Constants
Private Const FORM_KEY As String = "ServiceLog"

' Common Parameters
Private mPage As String
Private mServiceLogPk As Integer

' Objects
Private mCombinedParameters As ISKeyValueList
Private mParameters As ISKeyValueList
Private mStartupParameters As ISKeyValueList

Public Function Main(eventId As String,
                     parametersJson As String,
                     startUpParametersJson As String,
                     hostingContext As isefinHtmlWidgetHostingContext,
                     requestInfo As finScriptRequestInfo,
                     ByRef returnValue As String) As Boolean

  ' Assume Success
  Main = True

    ' Get Parameters
  mParameters = finBL.CreateKeyValueList()
  mParameters.FromSimpleJsonString(parametersJson)
  mStartupParameters = finBL.CreateKeyValueList()
  mStartupParameters.FromSimpleJsonString(startUpParametersJson)

  ' Get Combined Parameters (Startup Parameters updated with event Parameters)
  mCombinedParameters = mStartupParameters.Clone()
  mCombinedParameters.UpdateFromKeyValueList(mParameters, True)

  ' Get Common Parameters
  With mCombinedParameters
    mPage = .GetString("Page")
    mServiceLogPk = .GetInteger("ServiceLogPk")
  End With

  ' Update Parameters
  Select Case UCase(mPage)
    Case "BANK ACCOUNT ENQUIRY", "BANKING INTERFACE SUMMARY", "CREDIT BUREAU MONITOR", "CREDIT ENQUIRY", "ELECTRONIC SIGNATURE", "SMS MESSAGING", "SECURITY ENQUIRY", "PPSR TRANSACTION", "PPSR*"
      mPage = "Service"
  End Select
  
  ' Validate
  Main = finBL.HtmlWidgetUtilities.HasPermissionToViewFormKey(FORM_KEY)

  ' Handle Events
  If Main Then
    Select Case eventId
      Case ""
        ' Main event, i.e., return initial HTML content (excluding html and body tags)
        returnValue = ScriptInfo.TemplateText

      Case "Cleanse"
        ' Service Log Cleanse
        Main = Cleanse(returnValue)

      Case "Download"
        ' Download Service Log
        Main = Download(returnValue)

      Case "Fail"
        ' Fail
        Main = Fail()

      Case "GetInitialisationInfo"
        ' Get Initialisation Info
        Main = GetInitialisationInfo(returnValue)

      Case "GetRawData"
        ' Get Raw Request / Response Data
        Main = GetRawData(returnValue)

      Case "GetServiceSummary"
        ' Get Service Summary
        Main = GetServiceSummary(returnValue)

      Case "QuotationVoid"
        ' Quotation Void
        Main = QuotationVoid()

      Case "WizardValidate"
        ' Validate wizard page
        Main = WizardValidate(parametersJson, returnValue)

      Case Else
        finBL.Error.ErrorBeginFormat("Unhandled event '{0}'.", eventId)
        Main = False
    End Select
  End If

End Function

''' &lt;summary&gt;
'''  Get Initialisation Information required for this wizard.
''' &lt;/summary&gt;
Public Function GetInitialisationInfo(ByRef response As String) As Boolean

  Dim FormInitialisationInfo As FormInitialisationInfo
  Dim IsReadOnly As Boolean
  Dim LinkedLog As finLogRO
  Dim LinkedLogs As finLogs
  Dim ParentServiceLog As ISServiceLog
  Dim RelatedServiceLogs As List(Of RelatedServiceLog)
  Dim ServiceLog As ISServiceLog
  Dim ServiceSummaryHtml As String
  Dim Success As Boolean

  ' Assume Success
  Success = True

  ' Database Read Only
  IsReadOnly = finBL.Database.IsReadOnly

  ' Get Service Log(s)
  If Success Then
    If finBL.Database.GetServiceLog(mServiceLogPk, ServiceLog) Then
      ' Parent
      If ServiceLog.ParentServiceLogPk &lt;&gt; 0 Then
        Success = finBL.Database.GetServiceLog(ServiceLog.ParentServiceLogPk, ParentServiceLog)
      End If

      ' Linked Logs
      If Success Then
        Success = finBL.Utilities.GetServiceLogLinkedLogs(mServiceLogPk, LinkedLogs)
      End If

      ' Related Service Logs
      If Success Then
        Success = GetRelatedLogs(RelatedServiceLogs)
      End If
    Else
      Success = False
    End If
  End If

  ' Get Service Summary
  If Success Then
    Success = finBL.Utilities.GetServiceLogSummaryPageHtml(ServiceLog, ServiceSummaryHtml)
  End If

  ' Get Initialisation Info
  If Success Then
    FormInitialisationInfo = New FormInitialisationInfo()
    With FormInitialisationInfo
      ' Record
      .ServiceLogPk = ServiceLog.Pk

      .ServiceType = ServiceLog.ServiceType
      .TestMode = ServiceLog.TestMode
      .ServiceId = ServiceLog.ServiceId
      .ProductClass = ServiceLog.ProductClass
      .ProductId = ServiceLog.ProductId
      .CostCentreId = finBL.CostCentres.ItemByPkSafe(ServiceLog.CostCentrePk).CostCentreId
      .CostCentreDescription = finBL.CostCentres.ItemByPkSafe(ServiceLog.CostCentrePk).Description
      .EnquiryReference = ServiceLog.EnquiryReference
      .FollowupReference = ServiceLog.FollowupReference
      .RequestVersion = ServiceLog.RequestVersion
      .ProductOptions = ServiceLog.ProductOptions
      .ProductOptionsTooltip = ServiceLog.ProductOptionsTooltip
      .RequestReference = ServiceLog.RequestReference
      .RequestStatus = ServiceLog.RequestStatusText
      .QuotationStatus = ServiceLog.QuotationStatusText
      .ResponseStatus = ServiceLog.ResponseStatusText
      .ResponseReference = ServiceLog.ResponseReference
      .FailedReason = ServiceLog.FailedReason

      .SourceType = ServiceLog.SourceType
      If ServiceLog.SourcePk = 0 Then
        .SourceTypeFull = .SourceType
      Else
        .SourceTypeFull = String.Format("{0} ({1})", .SourceType, ServiceLog.SourcePk)

        ' Application Shortcut
        .SourceTypeApplicationShortcut = finBL.Utilities.GetServiceLogViewSourceApplicationShortcutUrl(ServiceLog, True)
      End If

      .ParentServiceLogPk = CStr(ServiceLog.ParentServiceLogPk)
      If ParentServiceLog IsNot Nothing Then
        .ParentServiceLogServiceType = ParentServiceLog.ServiceType
      End If

      .Chargeable = ServiceLog.Chargeable
      .ChargeCount = ServiceLog.ChargeCount
      .BillingReference1 = ServiceLog.BillingReference1
      .BillingReference2 = ServiceLog.BillingReference2
      .WindowsUser = ServiceLog.WindowsUser
      .MachineName = ServiceLog.MachineName
      .IpAddress = ServiceLog.IpAddress

      .AuditText = ""
      If finBL.Settings.TimeZoneUse Then
        If ServiceLog.CreatedDate &lt;&gt; Nothing Then .AuditText &amp;= finBL.Utilities.GetUserAndDateHtmlIncludingTimeZone("Created", ServiceLog.CreatedUserPk, ServiceLog.CreatedUtcDate) &amp; "&lt;/br&gt;"
        If ServiceLog.PendingUpdatedDate &lt;&gt; Nothing Then .AuditText &amp;= finBL.Utilities.GetUserAndDateHtmlIncludingTimeZone("Pending Status updated", ServiceLog.PendingUpdatedUserPk, ServiceLog.PendingUpdatedUtcDate) &amp; "&lt;/br&gt;"
      Else
        If ServiceLog.CreatedDate &lt;&gt; Nothing Then .AuditText &amp;= finBL.Utilities.GetUserAndDateHtml("Created", ServiceLog.CreatedUserPk, ServiceLog.CreatedDate) &amp; "&lt;/br&gt;"
        If ServiceLog.PendingUpdatedDate &lt;&gt; Nothing Then .AuditText &amp;= finBL.Utilities.GetUserAndDateHtml("Pending Status updated", ServiceLog.PendingUpdatedUserPk, ServiceLog.PendingUpdatedDate) &amp; "&lt;/br&gt;"
      End If
      If ServiceLog.PurgeAction &lt;&gt; iseServiceLogPurgeAction.None Then .AuditText &amp;= finBL.HtmlEncode(String.Format("Purge Action '{0}'.", ServiceLog.PurgeActionText)) &amp; "&lt;/br&gt;"
      If Len(ServiceLog.Comment) &lt;&gt; 0 Then .AuditText &amp;= "&lt;/br&gt;NOTE: " &amp; ServiceLog.Comment

      .ServiceSummaryHtml = ServiceSummaryHtml
      .ServiceSummaryCaption = ServiceLog.GetSummaryPageCaption()

      ' Control options
      .ShowExtended = (Len(ServiceLog.ExtendedData) &lt;&gt; 0)
      .ShowFail = (finBL.CurrentUser.IsAdministrator AndAlso ServiceLog.RequestStatus = iseAuditLogStatus.Pending AndAlso Not IsReadOnly)
      .ShowProperties = (Len(ServiceLog.Properties) &lt;&gt; 0)
      .ShowQuotationStatus = (ServiceLog.QuotationStatus &lt;&gt; iseServiceLogQuotationStatus.NotApplicable)
      .ShowQuotationVoid = (ServiceLog.QuotationStatus = iseServiceLogQuotationStatus.Pending AndAlso Not IsReadOnly)
      .ShowRequest = (Len(ServiceLog.Request) &lt;&gt; 0)
      .ShowRequestURL = (Len(ServiceLog.RequestUrl) &lt;&gt; 0)
      .ShowResponse = (Len(ServiceLog.Response) &lt;&gt; 0)

      If Len(.BillingReference2) &lt;&gt; 0 Then
        Select Case UCase(ServiceLog.ServiceId)
          Case "PPSRB2G.AU", "PPSRG2B.NZ"
            .BillingReference2Caption = "Billing Number:"
          Case "PPSRNZ"
            .BillingReference2Caption = "Payment Result:"
          Case Else
            .BillingReference2Caption = "Billing Reference:"
        End Select
      End If

      ' Linked Logs
      For Each LinkedLog In LinkedLogs
        .LinkedLogs.Add(New LinkedLog(LinkedLog))
      Next

      ' Related Logs
      .RelatedServiceLogs = RelatedServiceLogs

      ' Cleanse Action
      If finBL.CurrentUser.Permissions.Allow("ServiceLogs.Cleanse") AndAlso RelatedServiceLogs.Count &lt;&gt; 0 AndAlso Not IsReadOnly Then
        .AllowCleanse = (RelatedServiceLogs(0).PurgeAction &lt;&gt; "Cleansed")
      Else
        .AllowCleanse = False
      End If

      ' Configuration
      .Page = mPage
      .PromptOnCommit = finBL.CloudConnectFunctions.CloudConnectSettings.PromptOnCommit

      ' Special Page Handling
      If Len(.Page) &lt;&gt; 0 Then
        Select Case UCase(.Page)
          Case "SECURITY ENQUIRY"
            .Page = "Service"
        End Select
      End If
      
      ' Form Heading
      .FormHeading = ScriptInfo.ScriptCaption
      If Len(.FormHeading) = 0 Then .FormHeading = "Service Log"
      .FormHeading &amp;= " #" &amp; CStr(mServiceLogPk)
    End With
  End If

  ' Response
  If Success Then
    Success = finBL.Runtime.WebUtilities.SerialiseObjectToJsonString(FormInitialisationInfo, response)
  End If

  Return Success

End Function

''' &lt;summary&gt;
'''  Service Log Cleanse.
''' &lt;/summary&gt;
Private Function Cleanse(ByRef returnValue As String) As Boolean

  Dim ServiceLogCleanse As finServiceLogCleanse
  Dim Success As Boolean

  ' Assume Success
  Success = True

  ' Initialise
  ServiceLogCleanse = finBL.CreateServiceLogCleanse()

  ' Load
  If ServiceLogCleanse.Load(mServiceLogPk) Then
    returnValue = finBL.Utilities.GetHtmlFromSummaryTables(ServiceLogCleanse.CreateSummaryTables(), "Cleanse Service Log")
  Else
    Success = False
  End If

  Return Success

End Function

''' &lt;summary&gt;
'''  Download Service Log.
''' &lt;/summary&gt;
Private Function Download(ByRef returnValue As String) As Boolean

  Dim FileDownloadInfo As finFileDownloadInfo
  Dim ServiceLogs As ISServiceLogs
  Dim Success As Boolean

  ' Assume Success
  Success = True

  ' Get Service Logs
  Success = finBL.Database.GetServiceLogs(mServiceLogPk, ServiceLogs)

  ' Create Download
  If Success Then
    FileDownloadInfo = finBL.CreateFileDownloadInfo()
    With FileDownloadInfo
      If .LoadPlainText(ServiceLogs.ToXmlString(True), String.Format("ServiceLog_{0}.xml", ServiceLogs(0).Pk)) Then
        returnValue = .ToXmlString()
      Else
        Success = False
      End If
    End With
  End If

  Return Success

End Function

''' &lt;summary&gt;
''' Fail the 'Pending' Service Log.
''' &lt;/summary&gt;
Private Function Fail() As Boolean

  Dim Success As Boolean

  ' Assume Success
  Success = True

  ' Fail
  Success = finBL.Database.UpdatePendingServiceLogAsFailed(mServiceLogPk)

  Return Success

End Function

''' &lt;summary&gt;
'''  Retrieves Request / Response information for display.
''' &lt;/summary&gt;
Private Function GetRawData(ByRef returnValue As String) As Boolean

  Dim ServiceLog As ISServiceLog
  Dim Success As Boolean
  Dim Type As String

  ' Assume Success
  Success = True

  ' Parameters
  With mCombinedParameters
    Type = .GetString("Type")
  End With

  ' Validate Type
  Select Case UCase(Type)
    Case "REQUEST URL", "REQUEST", "RESPONSE", "EXTENDED DETAILS", "PROPERTIES"
      ' Ok
    Case Else
      Success = False
      finBL.Error.ErrorBegin("Invalid Type.")
  End Select

  ' Get Service Log
  If Success Then
    Success = finBL.Database.GetServiceLog(mServiceLogPk, ServiceLog)
  End If

  ' Get Response
  If Success Then
    With ServiceLog
      Select Case UCase(Type)
        Case "REQUEST URL": returnValue = .RequestUrl
        Case "REQUEST": returnValue = .Request
        Case "RESPONSE": returnValue = .Response
        Case "EXTENDED DETAILS": returnValue = .ExtendedData
        Case "PROPERTIES": returnValue = .Properties
      End Select
    End With
  End If

  ' Formatting
  If Success Then
    returnValue = finBL.Runtime.TextUtilities.JsonIndent(finBL.Runtime.TextUtilities.XmlIndent(returnValue))
  End If

  Return Success

End Function

''' &lt;summary&gt;
'''  Get Related Service Logs.
''' &lt;/summary&gt;
Private Function GetRelatedLogs(ByRef relatedLogs As List(Of RelatedServiceLog)) As Boolean

  Dim RelatedServiceLog As ISServiceLog
  Dim RelatedServiceLogs As ISServiceLogs
  Dim Success As Boolean

  ' Assume Success
  Success = True

  ' Initialise
  relatedLogs = New List(Of RelatedServiceLog)

  ' Get Related Service Logs
  Success = finBL.Database.GetServiceLogs(mServiceLogPk, RelatedServiceLogs, True, False)

  ' Related Logs
  If Success Then
    For Each RelatedServiceLog In RelatedServiceLogs
      relatedLogs.Add(New RelatedServiceLog(RelatedServiceLog))
    Next
  End If

  Return Success

End Function

''' &lt;summary&gt;
'''  Get Service Summary.
''' &lt;/summary&gt;
Private Function GetServiceSummary(ByRef returnValue As String) As Boolean

  Dim Data As Object
  Dim RelatedServiceLogs As List(Of RelatedServiceLog)
  Dim Success As Boolean
  Dim Summary As String

  ' Assume Success
  Success = True

  ' Get Summary
  Success = finBL.Utilities.GetServiceLogSummaryPageHtml(mServiceLogPk, Summary)  

  ' As something has changed, there may be additional related Service Logs so retrieve these now
  If Success Then
    Success = GetRelatedLogs(RelatedServiceLogs)
  End If

  ' Get Data
  If Success Then
    Data = New With {
      .Summary = Summary,
      .RelatedServiceLogs = RelatedServiceLogs
    }
  End If

  ' Finalise
  If Success Then
    finBL.Runtime.WebUtilities.SerialiseObjectToJsonString(Data, returnValue)
  End If

  Return Success

End Function

''' &lt;summary&gt;
'''  Get Wizard Finish Parameters.
''' &lt;/summary&gt;
Private Function GetWizardFinishParameters(parametersJson As String,
                                           ByRef wizardFinishParameters As WizardFinishParameters) As Boolean

  Dim obj As Object
  Dim Success As Boolean

  ' Assume Success
  Success = True

  ' Deserialise
  If finBL.Runtime.WebUtilities.DeserialiseJsonStringToObject(parametersJson, GetType(WizardFinishParameters), obj) Then
    wizardFinishParameters = DirectCast(obj, WizardFinishParameters)
  Else
    Success = False
  End If

  Return Success

End Function

''' &lt;summary&gt;
''' Void the 'Pending' Service Log.
''' &lt;/summary&gt;
Private Function QuotationVoid() As Boolean

  Dim Success As Boolean

  ' Assume Success
  Success = True

  ' Void
  Success = finBL.CreditBureau.VoidCreditEnquiryQuotation(mServiceLogPk)

  Return Success

End Function

''' &lt;summary&gt;
'''  Validate a Wizard page.
''' &lt;/summary&gt;
''' &lt;param name="parametersJson"&gt;
'''  A JSON formatted object containing information required to validate a Wizard page.
''' &lt;/param&gt;
''' &lt;param name="returnValue"&gt;
'''  A JSON object; "true" if validation passed, otherwise, information as to why validation failed.
''' &lt;/param&gt;
Private Function WizardValidate(parametersJson As String,
                                ByRef returnValue As String) As Boolean

  Dim Data As Object
  Dim FailedControlId As String
  Dim FailedMessage As String
  Dim PageId As String
  Dim Success As Boolean

  ' Assume Success
  Success = True

  ' Get Parameters
  ' NOTE: Use the module mCombinedParameters since this contains Startup and event Parameters in a single Key/Value List
  With mCombinedParameters
    PageId = .GetString("PageId")
  End With

  ' Validate Page
  Select Case PageId
    Case "General"
  End Select

  ' Finalise
  If Success Then
    Success = finBL.Runtime.WebUtilities.SerialiseObjectToJsonString(New WizardValidateResponse(Data, FailedMessage, FailedControlId), returnValue)
  End If

  Return Success

End Function



''' &lt;summary&gt;
'''  Wizard Initialisation Information.
''' &lt;/summary&gt;
Public Class FormInitialisationInfo

  ' Record
  Public ServiceLogPk As Integer

  Public ServiceType As String
  Public TestMode As Boolean
  Public ServiceId As String
  Public ProductClass As String
  Public ProductId As String
  Public CostCentreId As String
  Public CostCentreDescription As String
  Public EnquiryReference As String
  Public FollowupReference As String
  Public RequestVersion As String
  Public ProductOptions As String
  Public ProductOptionsTooltip As String
  Public RequestReference As String
  Public RequestStatus As String
  Public QuotationStatus As String
  Public ResponseStatus As String
  Public ResponseReference As String
  Public FailedReason As String
  Public SourceType As String
  Public SourceTypeFull As String
  Public SourceTypeApplicationShortcut As String
  Public ParentServiceLogPk As String
  Public ParentServiceLogServiceType As String
  Public Chargeable As Boolean
  Public ChargeCount As Integer
  Public BillingReference1 As String
  Public BillingReference2 As String
  Public WindowsUser As String
  Public MachineName As String
  Public IpAddress As String
  Public AuditText As String

  ' Logs
  Public LinkedLogs As New List(Of LinkedLog)
  Public RelatedServiceLogs As New List(Of RelatedServiceLog)

  ' Control Options
  Public ShowExtended As Boolean
  Public ShowFail As Boolean
  Public ShowProperties As Boolean
  Public ShowQuotationStatus As Boolean
  Public ShowQuotationVoid As Boolean
  Public ShowRequest As Boolean
  Public ShowRequestURL As Boolean
  Public ShowResponse As Boolean
  Public BillingReference2Caption As String

  ' Service Summary
  Public ServiceSummaryHtml As String
  Public ServiceSummaryCaption As String

  ' Configuration
  Public AllowCleanse As Boolean
  Public Page As String
  Public FormHeading As String
  Public PromptOnCommit As Boolean

End Class



''' &lt;summary&gt;
'''  Related Service Log.
''' &lt;/summary&gt;
Public Class RelatedServiceLog

  Public Pk As Integer
  Public ProductClass As String
  Public ProductId As String
  Public PurgeAction As String
  Public RequestReference As String
  Public ResponseReference As String
  Public ResponseStatus As String
  Public ServiceId As String
  Public ServiceType As String
  Public Status As String

  Public Sub New(serviceLog As ISServiceLog)

    With serviceLog
      Me.Pk = .Pk
      Me.ProductClass = .ProductClass
      Me.ProductId = .ProductId
      Me.PurgeAction = .PurgeAction.ToString()
      Me.RequestReference = .RequestReference
      Me.ResponseReference = .ResponseReference
      Me.ResponseStatus = .ResponseStatusText
      Me.ServiceId = .ServiceId
      Me.ServiceType = .ServiceType
      Me.Status = .RequestStatusText
    End With

  End Sub

End Class



''' &lt;summary&gt;
'''  Linked Log.
''' &lt;/summary&gt;
Public Class LinkedLog

  Public [Date] As Date
  Public Icon As String
  Public LogClass As String
  Public LogFormKey As String
  Public Pk As Integer
  Public SourceId As String
  Public Subject As String
  Public TooltipText As String

  Public Sub New(log As finLogRO)

    With log
      Me.Date = finBLShared.HtmlWidgetUtilities.GetJsonUtcDateTimeFromDatabaseDateTime(.LogDate)
      Me.LogClass = .LogClassText
      Me.LogFormKey = .LogFormKey
      Me.Pk = .Pk
      Me.SourceId = .SourceId
      Me.Subject = .Subject
      Me.Icon = finBLShared.Utilities.GetLogClassIcon(.LogClass, .SourceId, .SourcePk, Me.TooltipText)
    End With

  End Sub

End Class



''' &lt;summary&gt;
'''  Wizard Finish Parameters.
''' &lt;/summary&gt;
Public Class WizardFinishParameters

  Public FromNotes As String
  Public FromReference As String
  Public ToAccountId As String
  Public ToNotes As String
  Public ToReference As String

End Class



''' &lt;summary&gt;
'''  Validation details.
''' &lt;/summary&gt;
Public Class WizardValidateResponse

  Public Data As Object
  Public FailedControlId As String
  Public FailedMessage As String

  Public Sub New(data As Object,
                 failedMessage As String,
                 failedControlId As String)

    Me.Data = data
    Me.FailedMessage = failedMessage
    Me.FailedControlId = failedControlId

  End Sub

End Class</Code>
    <Language>VisualBasic</Language>
    <Notes>System defined HTML Widget.

Used as a finPOWER Connect Cloud compatible version of the form "ServiceLog".</Notes>
    <PermissionKeyExecute />
    <ReferenceLinq>false</ReferenceLinq>
    <RunWithoutPrompts>false</RunWithoutPrompts>
    <TemplateText>&lt;div id="frmMain" class="is-widget-content" style="visibility:hidden"&gt;

  &lt;!-- Form Header --&gt;
  &lt;header&gt;
    &lt;div class="header"&gt;&lt;/div&gt;
    &lt;div class="summary"&gt;&lt;/div&gt;
    &lt;!-- Tabs --&gt;
    &lt;div id="tabDetails" class="is-tabs"&gt;
      &lt;ul&gt;
        &lt;li tabId="General"&gt;General&lt;/li&gt;
        &lt;li tabId="PPSRB2GSearch"&gt;PPSR B2G Search&lt;/li&gt;
        &lt;li tabId="Service"&gt;Service Details&lt;/li&gt;
        &lt;li tabId="RelatedLogs"&gt;Related&lt;/li&gt;
        &lt;li tabId="LinkedLogs"&gt;Linked Logs&lt;/li&gt;
      &lt;ul&gt;
    &lt;/div&gt;
  &lt;/header&gt;

  &lt;!-- Pages --&gt;
  &lt;div class="is-widget-form-body"&gt;
    &lt;!-- General --&gt;
    &lt;div id="pageGeneral"&gt;
      &lt;table class="is-form"&gt;
        &lt;colgroup&gt;
          &lt;col style="width:8em" /&gt;
          &lt;col /&gt;
        &lt;/colgroup&gt;

        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;label id="lblRequestDetails"&gt;Request details&lt;/label&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="txtServiceType"&gt;Service Type:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;
            &lt;input id="txtServiceType" /&gt;
            &lt;input id="chkTestMode" type="checkbox" /&gt;
          &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="txtServiceId"&gt;Service Id:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="txtServiceId" /&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="txtProductClass"&gt;Product Class:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="txtProductClass" /&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="txtProductId"&gt;Product Id:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="txtProductId" /&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="cboCostCentre"&gt;Cost Centre:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="cboCostCentre" /&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="txtEnquiryReference"&gt;Enquiry Ref:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="txtEnquiryReference" /&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="txtFollowupReference"&gt;Followup Ref:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="txtFollowupReference" /&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="txtRequestVersion"&gt;Version:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="txtRequestVersion" /&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="txtProductOptions"&gt;Options:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="txtProductOptions" /&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr id="trProductOptionsTooltip" style="display:none;"&gt;
          &lt;th&gt;&lt;/th&gt;
          &lt;td&gt;&lt;div id="divProductOptionsTooltip" class="is-info-text info small"&gt;&lt;/div&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="txtRequestReference"&gt;Reference:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="txtRequestReference" /&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="txtRequestStatus"&gt;Status:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;
            &lt;input id="txtRequestStatus" /&gt;
            &lt;button id="cmdRequestUrl" class="is-button small"&gt;Request URL&lt;/button&gt;
            &lt;button id="cmdRequest" class="is-button small"&gt;Request&lt;/button&gt;
            &lt;button id="cmdFail" class="is-button small"&gt;Fail&lt;/button&gt;
          &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="txtQuotationStatus"&gt;Quotation:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;
            &lt;input id="txtQuotationStatus" /&gt;
            &lt;button id="cmdQuotationVoid" class="is-button small"&gt;Void&lt;/button&gt;
          &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;label id="lblChargeDetails"&gt;Charge details&lt;/label&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;input id="chkChargeable" type="checkbox" /&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="numChargeCount"&gt;Charge Count:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="numChargeCount" /&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="txtBillingReference1"&gt;Billing&amp;nbsp;Reference:&amp;nbsp;&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="txtBillingReference1" /&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="txtBillingReference2"&gt;Billing&amp;nbsp;Reference:&amp;nbsp;&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="txtBillingReference2" /&gt;&lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;label id="lblResponseDetails"&gt;Response details&lt;/label&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="txtResponseStatus"&gt;Status:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;
            &lt;input id="txtResponseStatus" /&gt;
            &lt;button id="cmdResponse" class="is-button small"&gt;Response&lt;/button&gt;
            &lt;button id="cmdExtended" class="is-button small"&gt;Extended&lt;/button&gt;
            &lt;button id="cmdProperties" class="is-button small"&gt;Properties&lt;/button&gt;
          &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="txtResponseReference"&gt;Reference:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="txtResponseReference" /&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="txtFailedReason"&gt;Failure Reason:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="txtFailedReason" /&gt;&lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;label id="lblSource"&gt;Source details&lt;/label&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="txtSource"&gt;Source:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="txtSource" /&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;/th&gt;
          &lt;td&gt;&lt;button id="cmdOpenSource" class="is-button small"&gt;Open&lt;/button&gt;&lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;label id="lblParent"&gt;Parent details&lt;/label&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="cboParentServiceLogPk"&gt;Parent Log:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="cboParentServiceLogPk" /&gt;&lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;label id="lblAuditLogOriginatorDetails"&gt;Originator details&lt;/label&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="txtAuditLogWindowsUser"&gt;Windows&amp;nbsp;User:&amp;nbsp;&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="txtAuditLogWindowsUser" /&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="txtAuditLogMachineName"&gt;Machine&amp;nbsp;Name:&amp;nbsp;&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="txtAuditLogMachineName" /&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="txtAuditLogIpAddress"&gt;IP&amp;nbsp;Address:&amp;nbsp;&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="txtAuditLogIpAddress" /&gt;&lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;label id="lblAuditDetails"&gt;Audit details&lt;/label&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;div id="divAuditDetails" class="is-info-text info"&gt;&lt;/div&gt;&lt;/th&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
    &lt;/div&gt;

    &lt;!-- PPSR B2G Search --&gt;
    &lt;div id="pagePPSRB2GSearch"&gt;
      &lt;table class="is-form"&gt;
        &lt;colgroup&gt;
          &lt;col style="width:8em" /&gt;
          &lt;col /&gt;
        &lt;/colgroup&gt;

        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;label id="lblPPSRB2GSearch"&gt;PPSR Search details&lt;/label&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;button id="cmdPPSRB2GSearch" class="is-button ok"&gt;View&lt;/button&gt;&lt;/th&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
    &lt;/div&gt;

    &lt;!-- Service --&gt;
    &lt;div id="pageService"&gt;
      &lt;div id="wbServiceSummary" class="is-dock-fill"&gt;&lt;/div&gt;
    &lt;/div&gt;

    &lt;!-- Related Logs --&gt;
    &lt;div id="pageRelatedLogs"&gt;
      &lt;div id="gridRelatedLogs"&gt;&lt;/div&gt;
    &lt;/div&gt;

    &lt;!-- Linked Logs --&gt;
    &lt;div id="pageLinkedLogs"&gt;
      &lt;div id="gridLinkedLogs"&gt;&lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;

  &lt;!-- Form Footer --&gt;
  &lt;footer&gt;
    &lt;button id="cmdActions" /&gt;

    &lt;button id="cmdCancel" class="is-button"&gt;Cancel&lt;/button&gt;
    &lt;button id="cmdBack" class="is-button"&gt;&amp;lt; Back&lt;/button&gt;
    &lt;button id="cmdNext" class="is-button"&gt;Next &amp;gt;&lt;/button&gt;
    &lt;button id="cmdFinish" class="is-button ok"&gt;Finish&lt;/button&gt;
  &lt;/footer&gt;

&lt;/div&gt;

&lt;script&gt;
// Properties
var mRecord;
var mRecord_LinkedLogs;
var mRecord_RelatedServiceLogs;

// Controls
var C = {
  //   General
  lblRequestDetails: null,
  txtServiceType: null,
  chkTestMode: null,
  txtServiceId: null,
  txtProductClass: null,
  txtProductId: null,
  cboCostCentre: null,
  txtEnquiryReference: null,
  txtFollowupReference: null,
  txtRequestVersion: null,
  txtProductOptions: null,
  trProductOptionsTooltip: null,
  divProductOptionsTooltip: null,
  txtRequestReference: null,
  txtRequestStatus: null,
  txtQuotationStatus: null,

  lblChargeDetails: null,
  chkChargeable: null,
  numChargeCount: null,
  txtBillingReference1: null,
  txtBillingReference2: null,

  lblResponseDetails: null,
  txtResponseStatus: null,
  txtResponseReference: null,
  txtFailedReason: null,

  lblSource: null,
  txtSource: null,

  lblParent: null,
  cboParentServiceLogPk: null,

  lblAuditLogOriginatorDetails: null,
  txtAuditLogWindowsUser: null,
  txtAuditLogMachineName: null,
  txtAuditLogIpAddress: null,

  lblAuditDetails: null,
  divAuditDetails: null,

  //   PPSR B2G Search
  lblPPSRB2GSearch: null,

  //   Service
  wbServiceSummary: null,

  //   Related Logs
  gridRelatedLogs: null,

  //   Linked Logs
  gridLinkedLogs: null,
}

// Form
var frmMain;
var tabDetails;

// Other
var mModalCleanse;

// Wizard Buttons
var cmdCancel;
var cmdBack;
var cmdNext;
var cmdFinish;

var cmdRequestUrl;
var cmdRequest;
var cmdFail;
var cmdQuotationVoid;
var cmdResponse;
var cmdExtended;
var cmdProperties;
var cmdOpenSource;
var cmdPPSRB2GSearch;

// ==========
// Initialise
// ==========
$(function () {
  // Mobile optimisations
  $(window).resize(Form_Resize);

  // --------
  // Controls
  // --------
  //   General
  C.lblRequestDetails = widget.UI.Label("lblRequestDetails", {});
  C.txtServiceType = widget.UI.TextBox("txtServiceType", {
    readOnly: true,
    width: "12em",
  });
  C.chkTestMode = widget.UI.CheckBox("chkTestMode", {
    readOnly: true,
    caption: "Test Mode?",
  });
  C.txtServiceId = widget.UI.TextBox("txtServiceId", {
    readOnly: true,
    width: "12em",
  });
  C.txtProductClass = widget.UI.TextBox("txtProductClass", {
    readOnly: true,
    width: "12em",
  });
  C.txtProductId = widget.UI.TextBox("txtProductId", {
    readOnly: true,
  });
  C.cboCostCentre = widget.UI.DBCombo("cboCostCentre", {
    formKeyOpen: "CostCentres",
    readOnly: true,
    showDropdown: false,
    width: widget.UI.FIELD_WIDTH_CODE_10,
  });
  C.txtEnquiryReference = widget.UI.TextBox("txtEnquiryReference", {
    readOnly: true,
  });
  C.txtFollowupReference = widget.UI.TextBox("txtFollowupReference", {
    readOnly: true,
  });
  C.txtRequestVersion = widget.UI.TextBox("txtRequestVersion", {
    readOnly: true,
    width: "12em",
  });
  C.txtProductOptions = widget.UI.TextBox("txtProductOptions", {
    readOnly: true,
    width: "12em",
  });
  C.trProductOptionsTooltip = $("#trProductOptionsTooltip");
  C.divProductOptionsTooltip = $("#divProductOptionsTooltip");
  C.txtRequestReference = widget.UI.TextBox("txtRequestReference", {
    readOnly: true,
  });
  C.txtRequestStatus = widget.UI.TextBox("txtRequestStatus", {
    readOnly: true,
    width: "12em",
  });
  C.txtQuotationStatus = widget.UI.TextBox("txtQuotationStatus", {
    readOnly: true,
    width: "12em",
  });

  C.lblChargeDetails = widget.UI.Label("lblChargeDetails", {});
  C.chkChargeable = widget.UI.CheckBox("chkChargeable", {
    readOnly: true,
    caption: "Chargeable?",
  });
  C.numChargeCount = widget.UI.NumberBox("numChargeCount", {
    readOnly: true,
    decimals: 0,
  });
  C.txtBillingReference1 = widget.UI.TextBox("txtBillingReference1", {
    readOnly: true,
    maxLength: 50,
  });
  C.txtBillingReference2 = widget.UI.TextBox("txtBillingReference2", {
    readOnly: true,
    maxLength: 50,
  });

  C.lblResponseDetails = widget.UI.Label("lblResponseDetails", {});
  C.txtResponseStatus = widget.UI.TextBox("txtResponseStatus", {
    readOnly: true,
    width: "12em",
  });
  C.txtResponseReference = widget.UI.TextBox("txtResponseReference", {
    readOnly: true,
    maxLength: 100,
  });
  C.txtFailedReason = widget.UI.TextBox("txtFailedReason", {
    readOnly: true,
    multiLine: true,
    rows: 7,
  });

  C.lblSource = widget.UI.Label("lblSource", {});
  C.txtSource = widget.UI.TextBox("txtSource", {
    readOnly: true,
    maxLength: 50,
  });

  C.lblParent = widget.UI.Label("lblParent", {});
  C.cboParentServiceLogPk = widget.UI.DBCombo("cboParentServiceLogPk", {
    formKeyOpen: "ServiceLog",
    readOnly: true,
    showDropdown: false,
    width: "12em",
  });

  C.lblAuditLogOriginatorDetails = widget.UI.Label("lblAuditLogOriginatorDetails", {});
  C.txtAuditLogWindowsUser = widget.UI.TextBox("txtAuditLogWindowsUser", {
    readOnly: true,
    maxLength: 50,
  });
  C.txtAuditLogMachineName = widget.UI.TextBox("txtAuditLogMachineName", {
    readOnly: true,
    maxLength: 50,
  });
  C.txtAuditLogIpAddress = widget.UI.TextBox("txtAuditLogIpAddress", {
    readOnly: true,
    maxLength: 50,
  });

  C.lblAuditDetails = widget.UI.Label("lblAuditDetails", {});
  C.divAuditDetails = $("#divAuditDetails");

  //   PPSR B2G Search
  C.lblPPSRB2GSearch = widget.UI.Label("lblPPSRB2GSearch", {});

  //   Service
  C.wbServiceSummary = widget.UI.PreviewPane("wbServiceSummary", {});

  // Grids
  C.gridRelatedLogs = widget.UI.Grid("gridRelatedLogs", {
    stickyHeader: true,

    onInitialiseRow: gridRelatedLogs_InitialiseRow,
    onRowDrilldown: gridRelatedLogs_RowDrilldown,
  });
  C.gridLinkedLogs = widget.UI.Grid("gridLinkedLogs", {
    stickyHeader: true,

    onAction: gridLinkedLogs_Action,
    onInitialiseRow: gridLinkedLogs_InitialiseRow,
    onRowDrilldown: gridLinkedLogs_RowDrilldown,
  });

  // Create Widget form
  // NOTE: Hide by default for a cleaner startup
  frmMain = new widget.UI.Form("frmMain", { visible: false });

  // Create Tabs
  tabDetails = new widget.UI.Tabs("tabDetails", {
    style: "normal",
    onSelectedTabChanged: tabDetails_Refresh,
  });

  // Handle Wizard Buttons
  cmdCancel = $("#cmdCancel");
  cmdBack = $("#cmdBack");
  cmdNext = $("#cmdNext");
  cmdFinish = $("#cmdFinish");
  cmdCancel.click(tabDetails_Cancel);
  cmdBack.click(function() { tabDetails_Move(-1); });
  cmdNext.click(function() { tabDetails_Move(1); });
  cmdFinish.click(function() { Form_ExecuteAction("Finish"); });

  cmdRequestUrl = $("#cmdRequestUrl");
  cmdRequestUrl.click(function() { GetRawData("Request URL"); });
  cmdRequest = $("#cmdRequest");
  cmdRequest.click(function() { GetRawData("Request"); });
  cmdFail = $("#cmdFail");
  cmdFail.click(function() { Form_ExecuteAction("Fail"); });
  cmdQuotationVoid = $("#cmdQuotationVoid");
  cmdQuotationVoid.click(function() { Form_ExecuteAction("QuotationVoid"); });
  cmdResponse = $("#cmdResponse");
  cmdResponse.click(function() { GetRawData("Response"); });
  cmdExtended = $("#cmdExtended");
  cmdExtended.click(function() { GetRawData("Extended Details"); });
  cmdProperties = $("#cmdProperties");
  cmdProperties.click(function() { GetRawData("Properties"); });
  cmdOpenSource = $("#cmdOpenSource");
  cmdOpenSource.click(function() { Form_ExecuteAction("OpenSource"); });
  cmdPPSRB2GSearch = $("#cmdPPSRB2GSearch");
  cmdPPSRB2GSearch.click(function() { Form_ExecuteAction("PPSRB2GSearch"); });

  // Handle Notifications
  widget.ActionNotificationHandle(Widget_NotificationHandler);

  // Reset
  Form_Reset();
});

// ==========
// Reset Form
// ==========
function Form_Reset() {
  // Defaults

  // Set Tab
  tabDetails.SelectedTabId("General");

  // Resize
  Form_Resize();

  // Load Record (i.e., initialise wizard)
  Record_Load();
}

// ===========
// Load Record
// ===========
function Record_Load() {
  // Initialise
  mRecord = null;
  mRecord_LinkedLogs = null;
  mRecord_RelatedServiceLogs = null;

  // Hide content
  frmMain.Visible(false);

  // Block UI
  widget.UI.Block("Initialising, please wait...");

  // Load Initialisation details
  widget.GetString("GetInitialisationInfo", {},
    // Success
    Record_Load_Done,

    // Fail
    function (message) {
      widget.UI.MsgBoxAlert("fail: " + message);
      Fields_Load();
    }
  );
}

function Record_Load_Done(data) {
  // Initialise
  mRecord = JSON.parse(data);
  mRecord_LinkedLogs = mRecord.LinkedLogs;
  mRecord_RelatedServiceLogs = mRecord.RelatedServiceLogs;

  // Page Visibility
  if (mRecord) {
    // Related Logs
    tabDetails.TabVisible("PPSRB2GSearch", mRecord.ServiceSummaryCaption == "PPSR B2G Search");
    tabDetails.TabVisible("Service", mRecord.ServiceSummaryHtml &amp;&amp; mRecord.ServiceSummaryCaption);
    tabDetails.TabVisible("RelatedLogs", mRecord_RelatedServiceLogs &amp;&amp; mRecord_RelatedServiceLogs.length &gt; 1);
    tabDetails.TabVisible("LinkedLogs", mRecord_LinkedLogs &amp;&amp; mRecord_LinkedLogs.length != 0);
  }

  // Default Page
  if (mRecord &amp;&amp; mRecord.Page) {
    tabDetails.SelectedTabId(mRecord.Page);
  }

  // Define Actions
  var actions = [];
  actions.push({ groupId: "", actionId: "Export", caption: "Export", icon: "Export" });
  if (mRecord &amp;&amp; mRecord.AllowCleanse) actions.push({ groupId: "", actionId: "Cleanse", caption: "Cleanse", icon: "Purge" });
  frmMain.ActionsDefine(actions, "cmdActions", Form_ExecuteAction);

  // Load Fields
  Fields_Load();
}

// ===========
// Load Fields
// ===========
function Fields_Load() {
  if (mRecord) {
    //   General
    C.txtServiceType.Text(mRecord.ServiceType);
    C.chkTestMode.Value(mRecord.TestMode);
    C.txtServiceId.Text(mRecord.ServiceId);
    C.txtProductClass.Text(mRecord.ProductClass);
    C.txtProductId.Text(mRecord.ProductId);
    C.txtEnquiryReference.Text(mRecord.EnquiryReference);
    C.txtFollowupReference.Text(mRecord.FollowupReference);
    C.txtRequestVersion.Text(mRecord.RequestVersion);
    C.txtProductOptions.Text(mRecord.ProductOptions);
    C.txtRequestReference.Text(mRecord.RequestReference);
    C.txtRequestStatus.Text(mRecord.RequestStatus);
    C.txtQuotationStatus.Text(mRecord.QuotationStatus);
    C.txtResponseStatus.Text(mRecord.ResponseStatus);
    C.txtResponseReference.Text(mRecord.ResponseReference);
    C.txtFailedReason.Text(mRecord.FailedReason);
    C.txtSource.Text(mRecord.SourceTypeFull);
    C.chkChargeable.Value(mRecord.Chargeable);
    C.numChargeCount.Value(mRecord.ChargeCount);
    C.txtBillingReference1.Text(mRecord.BillingReference1);
    C.txtBillingReference2.Text(mRecord.BillingReference2);
    C.txtAuditLogWindowsUser.Text(mRecord.WindowsUser);
    C.txtAuditLogMachineName.Text(mRecord.MachineName);
    C.txtAuditLogIpAddress.Text(mRecord.IpAddress);
    C.divAuditDetails.html(mRecord.AuditText);

    // Update Summary
    if (mRecord.ServiceSummaryHtml) {
      wbServiceSummary_Refresh(mRecord.ServiceSummaryHtml);
    }
  }

  // Unblock UI
  widget.UI.Unblock();

  // Update Controls

  // Update fields
  Fields_Update();

  // Refresh Tab
  tabDetails_Refresh();
}

// ===========
// Save Fields
// ===========
function Fields_Save() {
  // Not used by this wizard since there is no concept of updating an object behind the wizard
}

// =============
// Update Fields
// =============
function Fields_Update() {
  // Headings
  if (mRecord) {
    // Form Heading
    widget.SetHeading(mRecord.FormHeading);

    // Tab Heading
    frmMain.RefreshHeading("Service Log Details", mRecord.FormHeading + ".");
  }

  // Tab Captions
  if (mRecord) {
    if (mRecord.ServiceSummaryCaption) tabDetails.TabCaption("Service", mRecord.ServiceSummaryCaption);
  }

  // Information Lists

  // Lists
  if (mRecord) {
    C.cboCostCentre.RefreshUnbound(mRecord.CostCentreId, mRecord.CostCentreDescription);
  }

  // Controls
  if (mRecord) {
    // General
    if (!mRecord.ProductClass) C.txtProductClass.VisibleRow(false);
    if (!mRecord.CostCentreId) C.cboCostCentre.VisibleRow(false);
    if (!mRecord.EnquiryReference) C.txtEnquiryReference.VisibleRow(false);
    if (!mRecord.FollowupReference) C.txtFollowupReference.VisibleRow(false);
    if (!mRecord.ResponseReference) C.txtResponseReference.VisibleRow(false);
    if (!mRecord.FailedReason) C.txtFailedReason.VisibleRow(false);
    if (!mRecord.ShowQuotationStatus) C.txtQuotationStatus.VisibleRow(false);

    // Product Options
    if (!mRecord.ProductOptions) C.txtProductOptions.VisibleRow(false);
    if (mRecord.ProductOptions &amp;&amp; mRecord.ProductOptionsTooltip) {
      C.divProductOptionsTooltip.html(widget.UI.HtmlEncode(mRecord.ProductOptionsTooltip));
      C.trProductOptionsTooltip.show();
    }

    // Chargeable
    if (mRecord.Chargeable) {
      if (mRecord.ChargeCount == 0) C.numChargeCount.VisibleRow(false);
      if (!mRecord.BillingReference1) C.txtBillingReference1.VisibleRow(false);

      if (mRecord.BillingReference2) {
        C.txtBillingReference2.Caption(mRecord.BillingReference2Caption);
      }
      else {
        C.txtBillingReference2.VisibleRow(false);
      }
    }
    else {
      C.lblChargeDetails.VisibleRow(false);
      C.chkChargeable.VisibleRow(false);
      C.numChargeCount.VisibleRow(false);
      C.txtBillingReference1.VisibleRow(false);
      C.txtBillingReference2.VisibleRow(false);
    }

    // Source Type
    if (mRecord.SourceTypeFull) {
      if (mRecord.SourceTypeApplicationShortcut) {
        // Special Source handling
        switch (mRecord.SourceType.toUpperCase()) {
          case "BANKTRANSACTION":
            cmdOpenSource.text("View");
            break;
        }
      }
      else {
        cmdOpenSource.hide();
      }
    }
    else {
      C.lblSource.VisibleRow(false);
      C.txtSource.VisibleRow(false);
      cmdOpenSource.hide();
    }

    // Parent Log
    if (!mRecord.ParentServiceLogPk || mRecord.ParentServiceLogPk == "0") {
      C.lblParent.VisibleRow(false);
      C.cboParentServiceLogPk.VisibleRow(false);
    }
    else {
      C.cboParentServiceLogPk.RefreshUnbound(mRecord.ParentServiceLogPk, mRecord.ParentServiceLogServiceType);
    }

    // Originator Details
    if (!mRecord.WindowsUser) {
      C.lblAuditLogOriginatorDetails.VisibleRow(false);
      C.txtAuditLogWindowsUser.VisibleRow(false);
      C.txtAuditLogMachineName.VisibleRow(false);
      C.txtAuditLogIpAddress.VisibleRow(false);
    }

    // Buttons
    if (!mRecord.ShowRequestURL) cmdRequestUrl.hide();
    if (!mRecord.ShowRequest) cmdRequest.hide();
    if (!mRecord.ShowFail) cmdFail.hide();
    if (!mRecord.ShowQuotationVoid) cmdQuotationVoid.hide();
    if (!mRecord.ShowResponse) cmdResponse.hide();
    if (!mRecord.ShowExtended) cmdExtended.hide();
    if (!mRecord.ShowProperties) cmdProperties.hide();
  }

  // Check for Advanced options
  if (mRecord) {
  }

  // Update Buttons
  tabDetails_UpdateButtons();

  // Show content
  frmMain.Visible(mRecord != null);

  // Show History
  if (mRecord) {
  }

  // Resize Tab
  tabDetails_Resize();
}

// ===========
// Resize Form
// ===========
function Form_Resize() {
  // General

  // Tab
  tabDetails_Resize();
}

// ==============
// Wizard Buttons
// ==============
function tabDetails_Cancel() {
  if (widget.CanClose()) {
    widget.Close();
  }
  else {
    widget.Reset();
  }
}

function tabDetails_UpdateButtons() {
  // Back and Next Buttons?
  if (tabDetails.TabCount() == 1) {
    cmdBack.hide();
    cmdNext.hide();
  }
  else {
    var tabIndex = tabDetails.SelectedTabIndex();
    cmdBack.prop("disabled", tabIndex &lt;= 0);
    cmdNext.prop("disabled", tabIndex &gt;= tabDetails.TabCount() - 1);
  }

  // Custom
  // NOTE: Not a wizard, can only close
  cmdCancel.hide();
  cmdBack.hide();
  cmdNext.hide();
  cmdFinish.text("Close");
}

// ==========
// Resize Tab
// ==========
function tabDetails_Resize() {
  switch (tabDetails.SelectedTabId()) {
    case "General":
      break;

    default:
      break;
  }
}

// ===========
// Wizard Move
// ===========
function tabDetails_Move(direction) {
  var Ok;

  // Validate
  if (direction &gt; 0) {
    tabDetails_Validate(function () { tabDetails_MovePost(direction); });
  }
  else {
    // Can always move backwards
    tabDetails_MovePost(direction);
  }
}

function tabDetails_MovePost(direction) {
  var Ok = true;

  // Find Next Tab to Move To
  if (Ok) {
    var found = false;
    var newTab = tabDetails.SelectedTabIndex();

    do {
      newTab += direction;

      switch (tabDetails.GetTabIdByIndex(newTab)) {
        default:
          found = true;
          break;
      }

      // Found?
      if (found) {
        break;
      }
      else if (newTab == tabDetails.TabCount() - 1) {
        // Just in case!
        widget.UI.MsgBoxAlert("tabDetails_MovePost: Tab not handled!");
        break;
      }
    }
    while (true);

    // Refresh the New Tab
    tabDetails_Refresh(newTab);
  }
}

// ===========
// Refresh Tab
// ===========
function tabDetails_Refresh(newTab) {
  // Load details
  switch (tabDetails.SelectedTabId()) {
    case "RelatedLogs":
      gridRelatedLogs_Refresh();
      break;

    case "LinkedLogs":
      gridLinkedLogs_Refresh();
      break;

    default:
      break;
  }

  // Resize
  tabDetails_Resize();

  // Focus
  switch (tabDetails.SelectedTabId()) {
    default:
      tabDetails.FocusFirst();
      break;
  }
}

// ===============
// gridRelatedLogs
// ===============
function gridRelatedLogs_Refresh() {
  // Hide unused columns
  var showProductClass = false;
  var showRequestReference = false;
  var showResponseReference = false;

  // Determine if hidden columns are used
  for (var i = 0; i &lt; mRecord_RelatedServiceLogs.length; i++) {
    var item = mRecord_RelatedServiceLogs[i];

    if (item.ProductClass) showProductClass = true;
    if (item.RequestReference) showRequestReference = true;
    if (item.ResponseReference) showResponseReference = true;
  }

  // Add Columns
  C.gridRelatedLogs.ClearColumns();
  C.gridRelatedLogs.AddColumnDrilldown("Drilldown", { drilldownHideIfBlank: true });
  C.gridRelatedLogs.AddColumnInteger("Pk", { caption: "Pk" });
  C.gridRelatedLogs.AddColumnString("ServiceType", { caption: "Service Type" });
  C.gridRelatedLogs.AddColumnCode("ServiceId", { caption: "Service Id" });
  C.gridRelatedLogs.AddColumnString("ProductClass", { caption: "Product Class", visible: showProductClass });
  C.gridRelatedLogs.AddColumnCode("ProductId", { caption: "Product Id" });
  C.gridRelatedLogs.AddColumnString("Status", { caption: "Request Status" });
  C.gridRelatedLogs.AddColumnString("RequestReference", { caption: "Request  Reference", visible: showRequestReference });
  C.gridRelatedLogs.AddColumnString("ResponseStatus", { caption: "Response Status" });
  C.gridRelatedLogs.AddColumnString("ResponseReference", { caption: "Response Reference", visible: showResponseReference });

  // Actions

  // Refresh
  C.gridRelatedLogs.VirtualDataRefresh(mRecord_RelatedServiceLogs);
}

function gridRelatedLogs_InitialiseRow(e) {
  var item = mRecord_RelatedServiceLogs[e.row.listIndex];

  // Update cells
  e.row.AutoBind(item);

  // Styling
  e.row.cells.Pk.small = true;
  if (item.Pk == mRecord.ServiceLogPk) {
    e.row.backgroundColour = "#FFFFF0";
    e.row.cells.Drilldown.value = false;
  }
  else {
    e.row.cells.Drilldown.value = true;
  }
}

function gridRelatedLogs_RowDrilldown(e) {
  var item = mRecord_RelatedServiceLogs[e.row.listIndex];

  // Open Service Log
  widget.ExecuteApplicationShortcutUrl("app://FormShow?form=ServiceLog&amp;id=" + item.Pk);
}

// ===============
// gridLinkedLogs
// ===============
function gridLinkedLogs_Refresh() {
  // Add Columns
  C.gridLinkedLogs.ClearColumns();
  C.gridLinkedLogs.AddColumnDrilldown();
  C.gridLinkedLogs.AddColumnIcon("Icon", {});
  C.gridLinkedLogs.AddColumnString("LogClass", { caption: "Class", width: "8em" });
  C.gridLinkedLogs.AddColumnCode("SourceId", { caption: "Code" });
  C.gridLinkedLogs.AddColumnDateTime("Date", { caption: "Date" });
  C.gridLinkedLogs.AddColumnString("Subject", { caption: "Subject" });

  // Actions
  // Do not support adding a linked Log because currently you must specific a source Id when creating a Log in finCC
  //C.gridLinkedLogs.Actions().Define([{ actionId: "AddLink", tooltipText:"Add a Log linked to this Service Log", icon: "Log_Add" }]);

  // Refresh
  C.gridLinkedLogs.VirtualDataRefresh(mRecord_LinkedLogs);
}

function gridLinkedLogs_Action(actionId) {
  var item = mRecord_LinkedLogs[C.gridLinkedLogs.ActiveDataRowListIndex()];

  switch (actionId.toUpperCase()) {
    default:
      window.alert("Unhandled grid action '" + actionId + "'.");
      break;
  }
}

function gridLinkedLogs_InitialiseRow(e) {
  var item = mRecord_LinkedLogs[e.row.listIndex];

  // Update cells
  e.row.AutoBind(item);

  // Tooltip
  e.row.cells.Icon.tooltipText = item.TooltipText;
}

function gridLinkedLogs_RowDrilldown(e) {
  var item = mRecord_LinkedLogs[e.row.listIndex];

  // Open Log
  widget.ExecuteApplicationShortcutUrl("app://FormShow?form=" + item.LogFormKey + "&amp;id=" + item.Pk);
}

// ===============
// Validate Wizard
// ===============
function tabDetails_Validate(validCallback) {
  // Validate
  var Ok = tabDetails.Validate(true);

  // Other client-side validation
  if (Ok) {
    switch (tabDetails.SelectedTabId()) {
      case "Summary":
        if (mRecord.PaymentNotCleared) {
          var message = "&lt;p style='color:red'&gt;&lt;b&gt;WARNING:&lt;/b&gt; The Payment has not yet been cleared at the Bank.&lt;/p&gt;";
          message += "&lt;p&gt;Proceeding with the Transfer will lose the uncleared Funds status of this Payment.&lt;/p&gt;";
          message += "&lt;p&gt;Continue?&lt;/p&gt;";

          var options = {
            captionOk: "Yes",
            captionCancel: "No",
            messageIsHtml: true,
          };
          widget.UI.MsgBoxConfirm(message, options, validCallback);
          return;
        }
        break;

      case "General":
        // Has server-side validation
        break;

      default:
        // No validation
        validCallback();
        return;
    }
  }

  // Server-side validation
  if (Ok) {
    var params;

    switch (tabDetails.SelectedTabId()) {
      case "General":
        params = CreateFinishParameters();
        break;

      default:
        break;
    }

    if (params) {
      // Disable Form
      frmMain.FormDisable("Validating");

      // Extend parameters
      params.pageId = tabDetails.SelectedTabId();

      // Call WizardValidate method in Script
      widget.GetString("WizardValidate",
                       params,
                       function (data) { tabDetails_ValidatePost(validCallback, data); },
                       tabDetails_ValidateFail);
    }
    else {
      // No server-side validation
      validCallback();
    }
  }
}

function tabDetails_ValidatePost(validCallback, data) {
  // Enable form
  frmMain.FormEnable();

  // Parse Data
  var o = {};
  if (data) o = JSON.parse(data);

  if (o.FailedMessage) {
    // -----------------
    // Validation failed
    // -----------------
    var o = JSON.parse(data);
    widget.UI.MsgBoxAlert(o.FailedMessage);
    if (o.FailedControlId) $("#" + o.FailedControlId).focus();
  }
  else {
    // ---------------------
    // Validation successful
    // ---------------------
    // Validation could pass back additional information, e.g., to use in tabDetails_Refresh
    switch (tabDetails.SelectedTabId()) {
      case "General":
        // General
        if (o.Data &amp;&amp; o.Data.length != 0) {
          // Confirm warnings
          widget.UI.MsgBoxConfirmList("To continue, please approve the following:",
                                      o.Data,
                                      {
                                        heading: "Additional Confirmation",
                                        icon: "Warning",
                                      },
                                      function () { validCallback(); },
                                      null);

          // Allow callbacks to continue
          return;
        };

        break;
    }

    // Callback
    validCallback();
  }
}

function tabDetails_ValidateFail(errorMessage)
{
  widget.UI.MsgBoxAlert(errorMessage);

  // Enable form
  frmMain.FormEnable();
}

// ========================
// Create Finish Parameters
// ========================
function CreateFinishParameters() {
  var params = {
  }

  return params;
}

// =================
// Execute an Action
// =================
function Form_ExecuteAction(actionId) {
  switch (actionId.toUpperCase()) {
    case "CLEANSE":
      // Cleanse
      Form_ExecuteAction_Cleanse();
      break;

    case "EXPORT":
      // Export
      Form_ExecuteAction_Export();
      break;

    case "FAIL":
      // Fail
      Form_ExecuteAction_Fail();
      break;

    case "FINISH":
      // Finish
      Form_ExecuteAction_Finish();
      break;

    case "OPENSOURCE":
      // Open Source Log
      Form_ExecuteAction_OpenSourceLog();
      break;

    case "PPSRB2GSEARCH":
      // Open PPSR B2G Search Results
      Form_ExecuteAction_PPSRB2GSearch();
      break;

    case "QUOTATIONVOID":
      // Quotation Void
      Form_ExecuteAction_QuotationVoid();
      break;

    default:
      window.alert(mViewName + ".Form_ExecuteAction: Unhandled action '" + actionId + "'");
      break;
  }
}

// ==============
// Cleanse Action
// ==============
function Form_ExecuteAction_Cleanse() {
  // Block UI
  widget.UI.Block("Getting Cleanse Information, please wait...");

  // Get Summary
  widget.GetString("Cleanse", {},
    function(data) {
      // Unblock UI
      widget.UI.Unblock();

      // Show HTML
      mModalCleanse = widget.UI.Forms.ShowHtml("Cleanse Service Log", data);
    },

    function(errorMessage) {
      // Unblock UI
      widget.UI.Unblock();

      // Error
      widget.UI.MsgBoxAlert(errorMessage);
    }
  );
}

// =============
// Export Action
// =============
function Form_ExecuteAction_Export() {
  // Download Service Log
  widget.DownloadFile("Download", {});
}

// ===========
// Fail Action
// ===========
function Form_ExecuteAction_Fail() {
  if (mRecord.PromptOnCommit) {
    // Confirm
    widget.UI.MsgBoxConfirm("Update the Service Log's Status to 'Failed'?", {}, Form_ExecuteAction_Fail_Post);
  }
  else {
    // Commit without prompting
    Form_ExecuteAction_Fail_Post();
  }
}

function Form_ExecuteAction_Fail_Post() {
  // Block UI
  widget.UI.Block("Failing Pending Service Log, please wait...");

  // Fail
  widget.GetString("Fail", {},
    function() {
      // Unblock UI
      widget.UI.Unblock();

      // Reset Form
      widget.Reset();
    },

    function(errorMessage) {
      // Unblock UI
      widget.UI.Unblock();

      // Error
      widget.UI.MsgBoxAlert(errorMessage);
    }
  );
}

// ======================
// Open Source Log Action
// ======================
function Form_ExecuteAction_OpenSourceLog() {
  widget.ExecuteApplicationShortcutUrl(mRecord.SourceTypeApplicationShortcut);
}

// ============================
// Open PPSR B2G Search Results
// ============================
function Form_ExecuteAction_PPSRB2GSearch() {
  if (mRecord.ShowResponse) {
    widget.ExecuteApplicationShortcutUrl("app://FormShow?form=PPSRB2GAUSearchView&amp;serviceLogPk=" + mRecord.ServiceLogPk);
  }
  else {
    widget.UI.MsgBoxInfo("PPSR search information has been purged.");
  }
}

// =====================
// Quotation Void Action
// =====================
function Form_ExecuteAction_QuotationVoid() {
  if (mRecord.PromptOnCommit) {
    // Confirm
    widget.UI.MsgBoxConfirm("Do you want to update the Service Log's Quotation Credit Enquiry status to 'Voided'?", {}, Form_ExecuteAction_QuotationVoid_Post);
  }
  else {
    // Commit without prompting
    Form_ExecuteAction_QuotationVoid_Post();
  }
}

function Form_ExecuteAction_QuotationVoid_Post() {
  // Block UI
  widget.UI.Block("Voiding Pending Service Log, please wait...");

  // Quotation Void
  widget.GetString("QuotationVoid", {},
    function() {
      // Unblock UI
      widget.UI.Unblock();

      // Reset Form
      widget.Reset();
    },

    function(errorMessage) {
      // Unblock UI
      widget.UI.Unblock();

      // Error
      widget.UI.MsgBoxAlert(errorMessage);
    }
  );
}

// =============
// Finish Action
// =============
function Form_ExecuteAction_Finish() {
  // Not used by this HTML Widget
  Form_ExecuteAction_FinishPost();
}

function Form_ExecuteAction_FinishPost() {
  // Not used by this HTML Widget
  Form_ExecuteAction_FinishPost_Finalise();
}

function Form_ExecuteAction_FinishPost_Finalise() {
  // Close Form
  widget.Close();

  // Refresh Parent (to show updated details)
  widget.RefreshParent();
}

// ============
// Get Raw Data
// ============
function GetRawData(type) {
  // Block UI
  widget.UI.Block("Getting " + type + ", please wait...");

  // Params
  var params = {
    type: type,
  }

  // Get Data
  widget.GetString("GetRawData", params,
    function(data) {
      // Unblock UI
      widget.UI.Unblock();

      // Format HTML
      var html = "&lt;html&gt;&lt;pre lang='xml'&gt;" + widget.UI.HtmlEncode(data) + "&lt;/pre&gt;";

      // Display data
      widget.UI.Forms.ShowHtml("Service Log " + type, html);
    },

    function(errorMessage) {
      // Unblock UI
      widget.UI.Unblock();

      // Error
      widget.UI.MsgBoxAlert(errorMessage);
    }
  );
}

// ====================
// Notification Handler
// ====================
function Widget_NotificationHandler(actionId, data) {
  // Parse
  if (data) data = JSON.parse(data);

  // Handle Notifications
  switch (actionId.toUpperCase()) {
    case "SERVICELOG.REFRESH":
      // Close open modal forms
      if (mModalCleanse) {
        try {
          mModalCleanse.Close();
          mModalCleanse = null;
        } catch(error) {
          console.error(error);
        }
      }

      // Reload Service Log
      widget.Reset();
      break;

    default:
      // Refresh report
      wbServiceSummary_Refresh();
      break;
  }
}

// =======================
// Refresh Service Summary
// =======================
function wbServiceSummary_Refresh(html) {
  if (html) {
    wbServiceSummary_Refresh_Done(html, null);
  }
  else {
    // Refresh
    widget.GetString("GetServiceSummary", {},
      function(data) {
        // Parse
        if (data) data = JSON.parse(data);

        // Done
        wbServiceSummary_Refresh_Done(data.Summary, data.RelatedServiceLogs);
      },

      function(errorMessage) {
        widget.UI.MsgBoxAlert(errorMessage);
      }
    );
  }
}

function wbServiceSummary_Refresh_Done(html, relatedServiceLogs) {
  // Update Related Service Logs
  if (relatedServiceLogs) {
    mRecord_RelatedServiceLogs = relatedServiceLogs;
  }

  // Show Content
  C.wbServiceSummary.SetContent(html, false);
}

&lt;/script&gt;</TemplateText>
    <TemplateTextBookmarks />
    <TimeoutSeconds>60</TimeoutSeconds>
    <UniqueId>qo9NWG7AU0+QcowfUXcCbA</UniqueId>
    <AllowRefresh>true</AllowRefresh>
    <Caption />
    <HtmlWidgetAllowInitialEventCaching>false</HtmlWidgetAllowInitialEventCaching>
    <HtmlWidgetMaxHeight>1200</HtmlWidgetMaxHeight>
    <HtmlWidgetMaxWidth>1024</HtmlWidgetMaxWidth>
    <HtmlWidgetNeverApplyStyling>false</HtmlWidgetNeverApplyStyling>
    <HtmlWidgetResourceChartsApex>false</HtmlWidgetResourceChartsApex>
    <HtmlWidgetResourceCssSummaryPage2>false</HtmlWidgetResourceCssSummaryPage2>
    <HtmlWidgetResourceCssWidget>true</HtmlWidgetResourceCssWidget>
    <HtmlWidgetResourceJQuery>true</HtmlWidgetResourceJQuery>
    <HtmlWidgetResourceJQueryVersion />
    <HtmlWidgetSpecialEventGetFolderCount>false</HtmlWidgetSpecialEventGetFolderCount>
    <HtmlWidgetSpecialEventShowAsSummaryPage>false</HtmlWidgetSpecialEventShowAsSummaryPage>
    <HtmlWidgetSummaryPageObjectType>None</HtmlWidgetSummaryPageObjectType>
    <Icon />
    <RestrictedOriginsListEnabled>false</RestrictedOriginsListEnabled>
    <RunAsAdministrator>false</RunAsAdministrator>
    <WebServiceName />
    <WebServiceAllowAnonymous>false</WebServiceAllowAnonymous>
    <WebServiceSendDebugInformation>false</WebServiceSendDebugInformation>
    <ShowInMenu>None</ShowInMenu>
    <ParametersType>Custom</ParametersType>
    <Parameters>
      <ISParameterDefs version="1.00">
        <Parameters>
          <Parameter name="" type="SectionStart">
            <BlankTip />
            <Caption>Form options.</Caption>
            <StandaloneOnly>false</StandaloneOnly>
            <TooltipText />
            <SectionColumns>1</SectionColumns>
            <Visible>true</Visible>
          </Parameter>
          <Parameter name="ServiceLogPk" type="Number">
            <BlankTip />
            <Caption />
            <StandaloneOnly>false</StandaloneOnly>
            <TooltipText />
            <DefaultValueExpression />
            <Enabled>true</Enabled>
            <HideDescription>false</HideDescription>
            <IndentLevel>0</IndentLevel>
            <Mandatory>false</Mandatory>
            <NonPersistable>false</NonPersistable>
            <ReadOnly>false</ReadOnly>
            <ReadOnly2>false</ReadOnly2>
            <Value />
            <Visible>true</Visible>
            <DecimalPlaces>0</DecimalPlaces>
            <GroupDigits>true</GroupDigits>
            <MaxValue />
            <MinValue />
            <NumberSpecialType>None</NumberSpecialType>
            <SpinChange>1</SpinChange>
          </Parameter>
          <Parameter name="Page" type="Text">
            <BlankTip />
            <Caption />
            <StandaloneOnly>false</StandaloneOnly>
            <TooltipText />
            <DefaultValueExpression />
            <Enabled>true</Enabled>
            <HideDescription>false</HideDescription>
            <IndentLevel>0</IndentLevel>
            <Mandatory>false</Mandatory>
            <NonPersistable>false</NonPersistable>
            <ReadOnly>false</ReadOnly>
            <ReadOnly2>false</ReadOnly2>
            <Value />
            <Visible>true</Visible>
            <MaxLength>0</MaxLength>
            <Rows>1</Rows>
          </Parameter>
        </Parameters>
      </ISParameterDefs>
    </Parameters>
  </finScript>