Skip to main content

Hi, we are using k2 blackpearl. i would like to call K2 Workflow from CRM 2011 workflow and pass datafields to K2 workflow.


Please help on this error or suggest alternative way to call K2 Workflow. 


When CRM workflow is running i am getting following error.


Workflow paused due to error: Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'SourceCode.HostClientAPI, Version=4.0.0.0, Culture=neutral, PublicKeyToken=16a2c5aaaa1b130d' or one of its dependencies. The system cannot find the file specified.


Here is code for calling K2 workflow used in CRM Workflow:


Connection connection = new Connection();
connection.Open(_serverName, connectionString.ToString());
ProcessInstance processInstance = connection.CreateProcessInstance(_processName);
processInstance.DataFieldsd"accountid"].Value = accountid;
processInstance.Folio = _processFolio + System.DateTime.Today.ToString();
connection.StartProcessInstance(processInstance,false);
connection.Close();



 



 



 


Thanks for your time.

A couple of questions:


can you explain the environment? is CRM on the K2 box?


How are you starting the k2 process from CRM workflow, did you create a custom CRM workflow activity that calls the K2 API?


At a guess it looks like SourceCode.HostClientAPI.dll isn't in the GAC of the CRM machine that is trying to start the K2 process.


 


an alternative to using the K2 API would be to use the K2 Workflow REST Service to start the process. These services are documented in the K2 Developer documentation available for download from portal.k2.com or online at help.k2.com.


Thanks for your response.


we have K2 and CRM on different servers.  i created custom CRM workflow to call k2 workflow using k2 apis. i registered libraries in GAC.  i have same error .


I tried calling K2 workflow with REST calls from CRM workflow and it works now. i followed instructions from documentation.


thanks for your advice.


great to hear.


Reply