Skip to main content

A bit new to K2 and therefore this will probably be a very easy one for you all.


What is the best way to call stored procedures from a K2 workflow. The stored procedures will also need to return a couple of values that will be used in the workflow so I will need to know how to collect this data too.


Any help would be great



Cheers

There are many ways to call stored procedures.  The best way is the one that fits with your particular needs and development style.  Here are the ones I can think of, in no particular order:


- You can always use a server event (code) to write any .NET code you want.  You would call a stored procedure just like you would from any .,NET code.


- If you've already invested the time in building your own data access layer and put it in assemblies, you can reference those assemblies by clicking on the project references icon at the top of the designer canvas.  Once you've added them as a reference, you can create an instance of your classes in a server code event and invoke methods.


- If you've exposed your stored procs as a web service, you can add a web service reference from the same project reference icon, just click on the Web Reference tab in the resulting dialog.  Once you've added the web reference, you can invoke it just like you would any other .NET code.


- There are several blackmarket projects here on underground you may wish to consider.  There's the DynamicStoredProce service that you can add through the service  broker so you can expose your stored procs through SmartObjects.  There's also a DynamicWebService that can be used to expose web services to SmartObjects.


- If you're looking for something custom, you could take a look at the above ServiceObject projects (they come with source code) and build your own custom service object.


As you can see, there are several different ways to accomplish what you want.  Just pick the one that fits your preferences.


Thanks David

Reply