O'Reilly logo

SharePoint 2010 at Work by Mark Miller

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Writing a Survey ID to a List on Response Creation (without Workflow)

SharePoint surveys don’t fire a workflow. You can create one, but it will never fire.

And the reason is fairly understandable. When should it fire? When is the survey item created? When is it changed? To understand how difficult it is to answer those questions, I need to take a moment to explain how surveys work.

Surveys can take two forms, branched or unbranched. An unbranched survey looks a lot like any other list and functions almost exactly like it (except for workflows).

But, a branched survey is a completely different proposition.

Unbranched Versus Branched Surveys

When you have a branched survey, the questions are presented a few at a time and depend on the answers from previous questions. This is great, especially when you have a requirement that looks like this:

Do you like ice cream? If yes, which flavor?

In other words, if the answer is No, I’m not going to ask you which flavor is your favorite.

SharePoint accomplishes this by starting with a NewForm.aspx, just like other lists, but it only shows the first branch of the survey. When the user clicks Next, the answer to the first branch is saved and an ID is assigned to the survey. The next page is displayed using EditForm.aspx and passing in two parameters to the page: the ID of the survey, and the first question of the next branch. This happens each time the user clicks Next, until the last branch, when a Finish button is displayed rather than Next.

At any point, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required