Auto create a workspace - event handler or workflow designer?  
Author Message
Daren Coles





PostPosted: SharePoint - Development and Programming, Auto create a workspace - event handler or workflow designer? Top

Hi - what would be the quickest way to have a workspace automatically created when a check box column is ticked for a list item

Basically we need to replicate the functionality available in a calendar list where you can tick the checkbox to create a workspace when adding a new item but we need it for a Task and Issue list. From what I can tell, some level of coding is required but if anyone knows a way of creating this functionality without code that would be ideal. Otherwise whats the best design for coding this



SharePoint Products and Technologies4  
 
 
Ishai Sagi





PostPosted: SharePoint - Development and Programming, Auto create a workspace - event handler or workflow designer? Top

Darren,

I wouldnt recommend it, but if you must, I would go with an event handler and not a workflow. Both are a-synchronous, so if the site creation fails the user will now know about it (unless the code sends him an email) and the list item will still be saved (unless you roll it back in the code).

An event handler that overrides the *ItemAdded* and *ItemUpdating* events should take care of it. both events give you access to the properties of the list item, so you can check if the tick box was ticked, get properties values and then create the workspace if needed (maybe even put a link to the work space in a field of the item. I would recommend hiding that field from users in the edit\new forms and only displaying it in the "display" form. You can do that with my utility pack - www.codeplex.com/spstipsutilitypack)

I hope I helped you get on the right path!



 
 
Ishai Sagi





PostPosted: SharePoint - Development and Programming, Auto create a workspace - event handler or workflow designer? Top

I forgot to say why I dont recommend it.

The creation of a new site puts a load on the server, and creating a lot of them at once tends to result in database locks. This is a problem if you use event handlers or workflows to create sites, and your users are entering a lot of data at once (for example using the datasheet view).

I had a lot of grief with a solution like you are describing, and I would prefer to avoid it in the future.



 
 
Daren Coles





PostPosted: SharePoint - Development and Programming, Auto create a workspace - event handler or workflow designer? Top

Thanks Ishai - thats some good info. I was thinking along the same lines - everything we need to do in the workflow can be accomplished in Sharepoint Designer except this one stage. Using the event handler seems the quickest option to build and allows the remaining stages of the workflow to be supported by a non-developer - much more extensible.


 
 
Daren Coles





PostPosted: SharePoint - Development and Programming, Auto create a workspace - event handler or workflow designer? Top

By the way I don't think the load issue will be a problem here - it would be very rare that two project workspaces will be created at once - more likely one a week but given your warning I'll be careful about how I handle this in code. If you have any other advice before I kick-off the build I would like to hear it. Thanks again