' SummaryPage2_Workflow_KeyDetails
Option Explicit On
Option Strict On

' #################################################################
' Workflow Key Details
'
' Version: 2.03 (04/09/2017)
'
' Usage: Calls the Summary Script defined on the Workflow Type
'
' NOTES
' -----
' Do NOT set this Script as the Summary Page Script on a Workflow
' Type. This Script simply on-calls the Workflow Summary Script
' which, by default will be the built-in Script unless defined
' on the Workflow Type.
'
' Any of the constants defined in this Script can be overridden
' in the Summary Page Script that is called from this Script.
' Constants will be taken from this Script primarily though.
' #################################################################

'#const "ShowAccountMonitoring",Boolean,False,"Show full Monitoring block for Account Workflows"
'#const "ShowUserDefined",Boolean,False,"Show User Defined fields"
'#const "ShowUserDefinedItem",Boolean,True,"Show Item User Defined fields"
'#const "ShowNaItems",Boolean,True,"Show items flagged as 'Not Applicable'"
'#const "ShowSkippedItems",Boolean,False,"Show items flaged as 'Skipped'"

'#const "EventNumberOfDays",Integer,30,"Number of Days of Events to display."
'#const "EventAuditInclude",Boolean,False,"Include Audit Events?"
'#const "ShowEventBlock",Boolean,False,"Show Event block?"

Public Function Main(source As Object,
                     eventId As String,
                     eventArgs As ISKeyValueList,
                     ByRef handled As Boolean,
                     ByRef returnValues As ISKeyValueList,
                     ByRef text As String) As Boolean

  Dim Workflow As finWorkflow
  Dim WorkflowItem As finWorkflowItem

  ' Assume Success
  Main = True

  ' Get Parameters etc
  Workflow = DirectCast(source, finWorkflow)
  If eventArgs.Exists("WorkflowItem") Then
    WorkflowItem = DirectCast(eventArgs.GetObject("WorkflowItem"), finWorkflowItem)
  End If

  ' Use Summary Page functions
  If WorkflowItem Is Nothing Then
    text = finBL.SummaryPageFunctions.WorkflowSummary(False, workflow, ScriptInfo.ContextData.ToKeyValueList(), ScriptInfo.Constants.ToKeyValueList())
  Else
    text = finBL.SummaryPageFunctions.WorkflowItemSummary(False, workflowItem, ScriptInfo.ContextData.ToKeyValueList(), Nothing, ScriptInfo.Constants.ToKeyValueList())
  End If

End Function