Id: | 12404 |
Product: | finPOWER Connect |
Type: | NEW |
Version: | 2.02.03 |
Opened: | 19/06/2013 |
Closed: | 03/12/2014 |
Released: | 04/12/2014 |
Job: | J011736 |
![]() |
Workflows; Script can now set a Workflow Item's Source Object
Many types of Workflow Item can have a "Source" object, e.g., an Account type Workflow may have a "Credit Enquiry" type item that is repeated for each of the Account's Clients. Each of these "repeated" items will have a SourceObjectType property of Client and a SourceObjectPk of the Client's primary key.
An example of this is checking the "Repeat this item for each Account Client" box for an Account type Workflow.
The Workflow Type Item wizard now allows you to choose a Client Document for Account Workflows provided the "Repeat this item for each Account Client" box is checked.
To support this, "Send Document" type Workflow Items are now actioned slightly differently, as follows:
- If the Workflow Item does not have a specific Source Object set, the Document is sent as usual, e.g. an Account document is sent for Account type Workflows and a Client document for Client Workflows.
- If the Source Object is set then this will be used if possible, e.g.:
- If an Account type Workflow has a Workflow Item with a Client as a Source Object, this Client will be sent a document providing the Document is a Client type document; otherwise, if the Document is an Account type document, the Source Object will be ignored and an Account document sent.
NOTE: Document Logs were previously created for the Workflow's record, e.g. the Workflow Account. These are now created for the record that is receiving the Document (e.g., an Account or Client Log will be created). They will still be linked back to the creating Workflow Item in the same way.
When drilling down to a Workflow Item from the Workflows form, Items page, a new page, "Source Object" is displayed if applicable. This gives details of the source object and replaces the "Repeat" page that was previously shown in this wizard.
A Workflow Item's Source Object can now be set from Script as per the following example:
' Handle Events
Select Case eventId
Case "BeforeItemAction"
' Add two new Workflows items and allocate them to Clients
If workflowItem.ItemId = "ADDCLIENTS" Then
Dim WorkflowItemNew As finWorkflowItem
WorkflowItemNew = workflowItem.Parent.CreateWorkflowItem()
With WorkflowItemNew
.ItemType = isefinWorkflowItemType.Document
.Description = "Message to Client C10000"
.DocumentId = "CE" ' Client Email
.TemplateSubject = "A message to Client C10000"
.SourceObjectSetClientId("C10000")
End With
workflowItem.Parent.Add(WorkflowItemNew)
WorkflowItemNew = workflowItem.Parent.CreateWorkflowItem()
With WorkflowItemNew
.ItemType = isefinWorkflowItemType.Document
.Description = "Message to Client C10001"
.DocumentId = "CE" ' Client Email
.TemplateSubject = "A message to Client C10001"
.SourceObjectSetClientId("C10001")
End With
workflowItem.Parent.Add(WorkflowItemNew)
End If
End Select