Skip to main content
Nintex Community Menu Bar

I have a need to start a K2 workflow once a record gets inserted in a SQL Server table.   I can create a SQL trigger to launch a SQL server job or stored procedure once a record is created. My question, is there a way to only use SSIS or SQL Server to pass a parameter and start a workflow. I do not want to create a console application and need to do it all on the database server. 

Hi Faisal_Lodhi,

 

You can do this by calling class library from Sql server. 

 

Create a static class library  which will call "SourceCode.Workflow.Client.dll"  methods and then  Register this class library in sqlserver. while doing this you have to enable managed code execution feature of the SQL Server which is disabled by default.

 

let me know if it helps

 

 


Thank you Kran, your help is much appreciated.

I found this great article to help me with your steps . (https://www.codeproject.com/articles/19954/execute-net-code-under-sql-server).

 

I'm having some difficulty with the code.  I am more of a dba and wanted to see if can give examples of code (Connection string and pass in ID for parameters for workflow and start workflow) for the static library part (ManagedCodeAndSQLServer part in the article).

 


Hi Faisal Lodhi,

 

    Refer this link start k2 workflow from sql server using .net assemblies.

 

let me know if this helps you.

 

 


Looks like this might not be possible with SQL Server 2012+, when trying to load the assembly in SSMS.   It would of been a great service though.

 

CREATE ASSEMBLY for assembly 'WKFManagement' failed because assembly 'sourcecode.workflow.client' is malformed or not a pure .NET assembly.

Unverifiable PE Header/native stub.

 


Hi Faisal_Lodhi,

 

Error "CREATE ASSEMBLY for assembly 'WKFManagement' failed because assembly 'sourcecode.workflow.client' is malformed or not a pure .NET assembly."   could be resolved using  C# pInvoke. 

 

Anyway I have found another solution which is more easy  then this. In place of using .Net assembly (which is causing problem during assembly creation), we can use Rest Services. 

 

 click here to get more information on this

 

 

To enable  the Workflow REST services refer  DEVELOPERS REFERENCE

 

Let me know if  this helps you.


Reply