Article Details
Id:10906
Product:finPOWER Connect
Type:NEW
Version:1.06.07
Opened:07/02/2013
Closed:12/02/2013
Released:27/03/2013
Job: J011080

Workflows; new Workflow Type Script event 'UpdateDocumentsList' allows Documents published from Workflow Actions wizard to be modified

A new Workflow Type Script event, 'UpdateDocumentsList' has been added. This allows the list of Document presented in the Workflow Actions wizard to be modified.

By default, the list of Document includes Account Type Documents available to the Account Type for ALL of the selected Workflows.

Using this event allows Documents to be added or removed from the list. The sample below shows how a Document can be added to the list, even if it is not listed as 'Available' on the Account Type.

' Handle Events
Select Case eventId
  Case "UpdateDocumentsList"
    ' Update the list of Documents presented in the Workflow Actions wizard
    Dim Document As finDocumentRO
    Dim Documents As List(Of finDocumentRO)
    Dim Include As Boolean
    Dim TaskManagerWorkflow As finTaskManagerWorkflow
    Dim TaskManagerWorkflows As List(Of finTaskManagerWorkflow)
      
    Documents = DirectCast(otherParameters.GetObject("Documents"), List(Of finDocumentRO))
    TaskManagerWorkflows = DirectCast(otherParameters.GetObject("TaskManagerWorkflows"), List(Of finTaskManagerWorkflow))
      
    ' Add 'Repossession Authority' if not already added and ALL Workflows are for Account Type 'FR'
    If Documents.Contains(finBL.Documents("RA")) Then
      ' Already contains this Document
    Else
      ' Check we can add this Document (i.e., all Accounts are of type 'RC' or 'FR' in this example)
      Include = True
      For Each TaskManagerWorkflow In TaskManagerWorkflows 
        Select Case TaskManagerWorkflow.AccountTypeId
          Case "FR", "RC"
          Case Else
            Include = False
            Exit For
        End Select
      Next
      If Include Then Documents.Add(finBL.Documents("RA"))
    End If      
End Select

NOTE: The sample only includes the Document if it is applicable to all selected Workflows.