Skip to main content

Hi, I am an asp.net programer for several years but new to K2. I am having a question here hope someone can give me answer:

 

We have an asp.net application tries to hook up K2 blackpearl. While a k2 process running, we want to send instant messages in our application to the process starter and next activity destinations(if any). Instead programming in every activity, we want to call a message sending method every time process starts/action executes.

 

We do like this:

 

//Start process in sync mode

conn.StartProcessInstance(myProcess, true);

//Get process ID

string pid = myProcess.ID;

 

//Get next activity destination via SmartObject

...

SmartObjectClientServer socs= new SmartObjectClientServer();

...

SmartObject so= socs.GetSmartObject("Activity_Instance_Destination");

SmartListMethod getList = so.ListMethodst"List"];
so.MethodToExecute = getList.Name;
so.Propertiesr"ProcessInstanceID"].Value = pid
so.Propertiesr"Status"].Value = "Active";
SmartObjectList soList = socs.ExecuteList(so);

...

//loop the list to get users and send instant messages....

 

 

The problem is even we use the sync mode for process start and each action execute, sometime, we still get empty SmartObjectList (which means the next activity has not been created).

 

Did we do anything wrong or we should try diffrent approach? 

 

thanks!

 

 

 

When you say instant message are you talking mail or text messages? 

 

Either way you could take your code (it text messages) and wrap it in a service broker.  Then create a smartobject from that service broker.  You can then supply the ProcessOriginator (k2 object browswer) and the activity instance destination to your smartobject that performs and execute.  If you have a lot of activities you could write a sub workflow you call asychonously from your parent workflow.  This won't save you any time becuase you will still need to configure a wizard but you can then copy and paste to all your activities (should be pretty quick).  But, it does provide a nice reusable messaging option.


Reply