0

I have list in SharePoint with a field that I want to auto-populate based on values of other fields in the row. I would normally use a calculated field but the calculated field doesn't have everything I need to do that. Therefore, instead I would like to use a workflow on the list that is triggered when an item is created/changed and that will set the value of my calculated field. I've already done this by creating the workflow through the SharePoint UI but I would now like to do this using visual studio for ease of deployment.

1

The event receiver is much better suited for your task. You need to create an event receiver and handle ItemAdding/ItemUpdating or ItemAdded/ItemUpdated events in synchronous mode. Workflow is more useful for long-running operations whti often some people interaction involved.

  • Thanks. That worked great for me and did not require much code. – skeletank Feb 13 '12 at 21:16
1

I'm assuming this is for SharePoint 2010.

Using SharePoint Designer 2010 you can create workflows and then export them for ease of deployment. A workflow this simple will be easier in SPD vs Visual Studio.

If you want to do it in VS, you'll need VS2010, installed on a box with SharePoint installed. You can then create a SharePoint workflow project, then create some actions and using custom code you can modify the columns accordingly. There are a load of great tutorials to walk you through this process online.

1

I personally would recommend doing this in an event receiver instead of a workflow. Visual Studio 2010 has a nice project template you can use if you have SharePoint 2010 - otherwise look into a VS plugin tool called WSP Builder. This link can provide you some insight on how to create the event receiver.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.