Skip to main content
Hi All

I am creating a process to handle task management within my Sharepoint portal.

The process is built and basically works. However, the first event after "start" is create workspace in sharepoint. This works fine, but I need to set the "workspace name" to be a unique value everytime (I can't hang this from task title, date, etc as none of these will be a unique value).

I have added a new activity inbetween start and create task site. Within the]is new activity (set folio field) I have a default server event with the following:


public void Main(object Bevel, ServerEventContext K2)
{
K2.Synchronous = true;

K2.ProcessInstance.Folio = K2.ProcessInstance.ID.ToString();
}


The idea is that when the process triggers, I set the folio field to be = process instance ID. I can then use the folio field as my workspace name on the next activity.

However, when I run the process, I get an error in the K2 Server Console. I have tried to run it three times now with the following errors (nothing changed inbetween)


Set Folio Field ServerEvent: Method K2Code188.Main not found

Set Folio Field ServerEvent: Method K2Code214.Main not found

Set Folio Field ServerEvent: Method K2Code240.Main not found

Can anyone help me identify the problem here? Obviously my code is C#. Am I going about this in the best way?

Many thanks for any help

Rich
try re-creating the event or even the whole activity with the same code again

sounds odd but i've had something similar recently where it wouldn't even compile in the first place. copied the code, deleted the event & added a new event, pasted the code & it worked 🙂
Thanks for the reply!

I didn't really have the time to rebuilt... And it seemed to me more like I was missing something from my code (I got this impression from the fact that the number in the error message was incrementing each time without me changing anything, suggesting that maybe *something* was working in there!).

In the end I decided on a different course of action. I wrote to a sharepoint list before creating the workspace, generating a list item ID which I then used as my workspace name.

If anyone has a different solution to this problem I would be very interested to hear it!

Regards,

Rich
I think the problem lies in your Main proc definition:

public void Main(object Bevel, ServerEventContext K2)

Should be:

public void Main(ServerEventContext K2)

Regards,
Ockert
Thanks very much for the advice.

I assumed a syntax problem as I was using a conversion tool to go from .vb to c#.

Well I have a good workaround now anyway, but I will be sure to come back and try this as I'm sure it will be useful on future jobs.

Many thanks again,

Richard

Reply