I'm currently running the latest version of K2 BlackPoint 4.5 1290 and I'm trying to figure out how to query a sql database and return the records back to a workflow process created in K2 Studio.
Any help is much appreciated.
I'm currently running the latest version of K2 BlackPoint 4.5 1290 and I'm trying to figure out how to query a sql database and return the records back to a workflow process created in K2 Studio.
Any help is much appreciated.
you may use reference event wizard. there are 2 options: with class library or web service.
first create one of them to access your database, and add reference in your k2 process. after that just click next next and next but don't forget to follow instruction in each reference event wizard process.
inside the wizard, you'll asked when and where will you assign and or retrieve value to/ from database
Hi Guys,
#### In the future this will become way easier with the inclusion of SQL based SmartObject in K2 blackpoint, currently slated for the next update (K2 blackpoint 4.5 1350) ####
We will have support for SQL based object out of the box, the steps below:
Create SQL based SmartObjects that you would like to use in your process
1. Open “SharePoint 2010 Central Administration” on your machine and click the “K2 for SharePoint” section
2. Under the “Data Management” section click the “Manage SQL SmartObjects” option
3. Create a “New Connection” on this page by specifying the actual SQL Server name and Database name that you would like to connect to
4. In the next step you will be presented with a list of SQL based object available in the Database specified in the connection, these are categorized by Tables, Views and Stored Procedures and you can create SmartObjects from any of these
5. Select the Table that contains the info you would like to use in your workflow, forms or reports and click on the Create button
Once you have created the SQL bases SmartObject you can use it in a number of ways in your workflow, as an example you could use it in Destination rules or to calculate the average of sales in a specific region (using Inline Function) and use this as flow logic in line rules. Follow the steps below to return a value from the SmartObject and store that in a Process Data Field:
1. In K2 Studio add a Data Event onto any activity and select the “Transfer Data” option on the second screen
2. In the next screen click “Assign”, for the Source we will make use of a value coming from our SmartObject. In the Context Browser select the Environment tab and locate the SmartObject Server node and expand the node down to where you see a folder labeled SQL, under this folder you will see the SmartObjects grouped in a folder named the same as the connection you have created in the previous section
3. From here you can choose the method you would like to use to return the data, if you have the key for the specify record you need you can make use of the Load method, in my case all I know is that the current request is associated with a specific Region (stored in a process data field) so I will make use of the List method to return the Sales Person associated with that region and store the result in a Process Data Field
4. In the next section you need to specify the Filter criteria as illustrated below
From this point onwards you should be good to go, let me know if you have any questions or need some additional guidance
Hey Renier - I don't see the “Data Management” section in my K2 for SharePoint section in Central Admin. I currenlty have K2 BlackPoint 4.5 1290 version. Is this only available to K2 BlackPearl?
Hi Ahmed - My mistake, this is something that is on the roadmap and will be an enhancement for K2 blackpoint in the next release
That's great that it's on the next release but is there a temporary solution that I can use in the meantime to query a database?
For now i suggest you follow the advice given by Marengga, that is spot-on with how i would do it currently
Are you working with SharePoint 2010? If so SharePoint 2010 has a new feature called External Lists that allows you to expose a SQL table as a SmartPoint List. Once that's done you can use the K2 Site Settings and then K2 SmartObject Site Lists and Libraries option to expose the list as a SmartObject. This will give you the regular CRUD methods including the Get List to query the records which you`ll then be able to do within the workflow.
I've done some simple tests of that technique and it appeared to work fine but I do imagine there would be some performance implications going through the multiple layers so you'd need to validate with your own data.
Here is a blog that shows you how to create the SharePoint External List connection: http://blogs.pointbridge.com/Blogs/monnette_jeff/Pages/Post.aspx?_ID=23
Hope this helps.
Tim
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.