I can programmatically create a survey list and add questions to it. How do I define branching?
1 Answer
Well, it was an epic adventure into lands unknown, and I may have found your answer.
First of all, some background:
- Questions on a survey are represented by fields in a list (they all inherit from
SPField
) - Choices in a list (and a survey) are stored as an
SPFieldChoice
It seems the "Jump To" destinations are associated with the choice field, and can be accessed using SPFieldChoice.ChoicesJumpTo
.
The strings in this collection are the Internal Names of the fields (that represent the questions) to jump to.
The position of the items in this collection specifically relate to the positions of the choices in their own collection (e.g. choosing the second option in the drop-down causes the survey to skip to the second field/question named in the JumpTo list).