Miruna, below is my script. Is there any other way using when any user can terminate workflow when required.?
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Data.SqlClient
Imports System.Text
Imports LFSO83Lib
Imports Laserfiche.Workflow
Imports Laserfiche.Workflow.Objects
Imports Laserfiche.Workflow.Objects.Instances
Namespace WorkflowActivity.Scripting.TerminateWorkflowsonthebasisofentryID
'''<summary>
'''Provides one or more methods that can be run when the workflow scripting activity is performed.
'''</summary>
Public Class Script1
Inherits SDKScriptClass83
'''<summary>
'''This method is run when the activity is performed.
'''</summary>
Protected Overrides Sub Execute()
Dim wfcon as WorkflowConnection
Dim wftostart as PublishedWorkflow
Dim wfoptions as SearchFilterOptions
Dim wfresult as SearchResult
Dim wfinstance as WorkflowInstance
Dim wfentry as StartingEntry
Dim wfinitiator as Initiator
wfcon = WorkflowConnection.CreateConnection("Workflow Server Name", "Sample")
wftostart = wfcon.Database.GetPublishedWorkflow("Insert Workflow Name Here")
wfoptions = new SearchFilterOptions()
wfoptions.Statuses = SearchFilterOptions.WorkflowStatus[]{SearchFilterOptions.WorkflowStatus.Running}
wfoptions.MinEntryId = 1 'Fill in your entry id here
wfoptions.MaxEntryId = 1
for each wfresult in wfcon.Database.Tracking.SearchWorkflowInstances(options)
wfinstance = wfresult.WorkflowInstance
wfentry = wfinstance.StartingEntry
wfinitiator = wfinstance.Initiator
wfinstance.Terminate("Testing Termination using script")
'workflowToStart.StartWorkflow("Insert another workflow to start here", entry, initiator, null, null)
next
End Sub
End Class
End Namespace