0

I have a workflow which runs every time a new list item is added.

The list item comprises of 3 fields:

  1. a question,
  2. a person to answer the question,
  3. an answer.

The first 2 fields are supplied by the user who creates the list item, and the workflow routes the item to the expert who supplies #3, the answer.

On the answer form, I would like the question field to be populated with the question, however I can't drag the question field onto the form without it creating a repeating section, when it should be creating a textbox? It says the type is a group rather than just a string?

I'd also like to know how to get workflow variables into InfoPath forms.

Any ideas on how I'd go about creating a simple q&a collection workflow would be most appreciated.

The tl;dr part is the workflow needs to do this :

  1. ask a question and specify a named user
  2. route to user via workflow
  3. get an answer from user

and that's it.

1 Answer 1

0

Your first issue is caused by the fact that your question node is a repeating node in your xml schema (see Data, Show fields, then double click the node and see that the Repeating check box is ticked). I suspect you probably wanted a repeating group with Question and Answer nodes. You would then drag the group onto the form. However it might be easier to simply hard code your schema to a specific number of questions as it'll save a bit of jiggery pokery getting the question text loaded in as you'll see below.

The second part is a little more involved and there are few good explainations on the web on how to do it. I have 2 books and neither are great at explaining this! Firstly you need to create a secondary datasource in the form and link it to an ItemMetadata.xml file which contains

<z:row xmlns:z="#RowsetSchema" ows_Question1="" /> <z:row xmlns:z="#RowsetSchema" ows_Question2="" />

etc. - note no root node exaclty like shown.

Then in your workflow you can set the value that your form will get in this secondary datasource at runtime by using something like:

MyFirstTaskTaskProperties.ExtendedProperties["Question1"] = "The text of question 1";

In your infopath form you should set the default value of Main datasource question field to the node in the secondary datasource. Then when the thing runs it will work.

I hope you are reasonably familiar with SharePoint workflows as there are quite few other things you need to do to get an infopath form working in a workflow. In my experience it's quite painful getting it all working. Good luck my friend.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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