HI,
Thank you for your reply. I have tried to create a console app using the tutorials, but cannot seem to get it to work.
If I'm right in my understanding then the console App basically acts as if a record was selected and the workflow executed. Based on this understanding I came up with the following code from various posts. The workflow executes a SQL query on a legacy database and creates records in CRM from the results. If i manually run the workflow it works perfectly, however although I'm getting no errors, when running the code below, nothing happens and I don't know where to go from here. Would it be the credentials , should I be using a domain name and password and if so how ?
Sub Main()
Try
Dim Credentials As ClientCredentials = New ClientCredentials()
Credentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials
Dim OrganizationUri As Uri = New Uri("https://xxx.xxxxxxx.co.uk:444/XRMServices/2011/Organization.svc")
Dim HomeRealmUri As Uri = Nothing
Dim serviceProxy As OrganizationServiceProxy = New OrganizationServiceProxy(OrganizationUri, HomeRealmUri, Credentials, Nothing)
' Workflow Guid
Dim _workflowId = New Guid("fa69cfbc-f14e-4dfc-a098-d1cd339cac62")
' existing record Guid
Dim _entityId = New Guid("566AC746-91E3-EA11-9171-0050560105A7")
Dim request As ExecuteWorkflowRequest = New ExecuteWorkflowRequest() With {
.WorkflowId = _workflowId,
.EntityId = _entityId}
Dim response As ExecuteWorkflowResponse = CType(serviceProxy.Execute(request), ExecuteWorkflowResponse)
Catch ex As Exception
MsgBox(ex.Message.ToString)
End Try
End Sub