I want to know.
- If i want to use trigger in K2 Blackpearl how to
- where is document or sample
thks for reply
Sorry, may be i ask the question not clarify. Now I have database backend is sqlserver 2005 (not database of blackpearl) and some activity in workflow want to check something in the database backend such as : check field finished = true . When the K2 know status finished equal true then goto next activity. And i want to set time to check it such as : 2 hours check one time. I don't know you or anybody have the solution to do this. The first think for me I think I can use trigger for check it but I don't know how to use it
One way would be is to use a Async Server Event. Do the external call to your database to pass in the server event instance ID.
Write a .NET trigger on the table to do a OpenServerItem call back to the process to update the data and call the Finish method. Here's a sample taken from the K2 SDK.
//Open the Connection connection.Open(serverName); //Get the ServerItem serverItem = connection.OpenServerItem(serialNumber); //Update Process Data or XML Field serverItem.ProcessInstance.DataFields["Result"].Value = "Complete"; serverItem.ProcessInstance.XmlFields["Date"].Value = System.DateTime.Now.ToString(); serverItem.ProcessInstance.XmlFields["Time"].Value = System.DateTime.Now.Hour.ToString() + ":" + System.DateTime.Now.Minute.ToString(); //Update Activity Data or XML Field serverItem.ActivityInstanceDestination.DataFields["Result"].Value = "Complete"; serverItem.ActivityInstanceDestination.XmlFields["Date"].Value = System.DateTime.Now.ToString(); serverItem.ActivityInstanceDestination.XmlFields["Time"].Value = System.DateTime.Now.Hour.ToString() + ":" + System.DateTime.Now.Minute.ToString();
//Complete the server event.
serverItem.Finish(); //Close the Connection
Thanks for the best answer. I understood a little bit. If you can introduce article about this I think the best way for me. because I have a newbie for k2. And you can expand about .NET trigger I never do it.
Triggering .NET code from a SQL trigger isn't a K2 specific thing. There's a lot of articles on the web on this. Here's one for reference.
Thank you very much. I try learn and do it
Now I write .Net Trigger and hook to database finished. But I can't use object K2 such as:sourcode.HostClientApi,Sourcode.WorkFlow.Management to open method OpenServerItem in my .Net Trigger code. Because when I add them and I try to hook to database. I have error sound like "Sourceode.HostClientAPI not pure .Net Assembly"
My Sample Code:
sqlComm.Connection = connection
userType = sqlComm.ExecuteScalar.ToString()
- How to do that (Open method OpenServerItem in my .Net Trigger)
- You talk about Async Server Event. You mean what even IPC Event or Server Event
- How to I can use external call
FYI, KB 272 (http://kb.k2workflow.com/articles/kb000272.aspx) goes into detail on how to use an Async Server Event in K2.
I verified this behavior and I think it is because of a limitation in SQL in dealing with mixed assemblies. See this thread on the microsoft forum (http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=1132820&SiteID=1).
One way to get around this is to wrap the K2 calls into a web service and then create a .NET class stub which calls this. You should at this point be able to register the class stub as it is considered a pure assembly.
The other method I saw from some other posters was that you could try to expose the assembly using a COM wrapper and then invoke it from there.
Not too nice but it's still an option.
I also need to do this but am using K2 Blackpoint, this is very simple in SPD & Nintex as they have a 'Wait Until' option that you can pause a worklow until a certain field = a certain value, I cant believe you cant do this easily in K2 like you can SPD & Nintex, am I missing something ??
From what I understand from this thread (http://connect.nintex.com/forums/thread/322.aspx). That particular event is using a polling mechanism which also depends on the SharePoint Timer service.
The reason we try to use the callback mechanism (async event) is because of performance under high load.
You *could* easily do the same polling mechanism by using a looping activity (i.e. a line drawn back to the same activity and set a start rule on it. In the activity you can add an event to do the check on whatever field you need).
However, from my experience, this is bad design for enterprise environments when the load increases. Just imagine thousands of active instances polling every x interval. This causes your workflow server to freeze up during high concurrency of polling and there is also a high chance you will get deadlocks/timeout issues.
Thanks for the reply above I can see the problems with using the Nintex way in a large enterprise environment.
Im still not sure though how I can do this in Blackpoint, Ive seen a post, I think from you suggesting a way you could achieve it in Blackpearlm but is it possible to achieve this in Blackpoint ?
I believe it's the same in blackpoint or blackpearl.
Here's a screenshot which might make it clearer.
It basically makes use of the start rule and the line rules.
Convert DVD to iPhone
Thanks for that but if you had to implement something like that in Blackpoint (no blackpearl), is that the only way you can achieve it or are there better options using Blackpoint ? As you say I dont really want to use that solution as it could possibly bring the server down if we have loads of these instances running & is not scalable.
I assume you are referring to the callback using the asynchronous server event.
Nope, I don't think it is possible to do that in blackpoint due to the missing server event. I would say that this is a blackpearl feature only.
So if this is a key feature that is needed, I would probably want to look at blackpearl instead of blackpoint. The API and code capabilities in blackpearl introduce more flexibility and capability in your workflow designs.
Ok, thanks for all your help Jonny, much appreciated.
Already have an account? Login
No account yet? Create an account
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.
Sorry, we're still checking this file's contents to make sure it's safe to download. Please try again in a few minutes.
Sorry, our virus scanner detected that this file isn't safe to download.
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.