I have a workflow where I am trying to create an item in a list. There are several different lists, and what I would like to do is to be able to choose a list by the value of a variable. So instead of having seperate branches for creating an item, I would like to have one action that will choose a list based on the value of the variable and creates the item in that list. Is this possible? Thanks.
Solved! Go to Solution.
Hi David H ,
How many lists are we talking about here?
You might have a condition in your main list to determine where the item is created. You can create a calculated column to determine the name of the list. For e.g. if FieldA has value list1, list2, etc...then calculated column would be:
ListName = IF(FieldA=="list1","ListA",IF(FieldA=="list2","ListB",IF(......))) etc.
Finally your calculated column will have value of <ListName> where item will be created.
In your workflow, use Web service action to create item in the list. URL: Web URL/_vti_bin/lists.asmx
Use the web method as UpdateListItems
List name will be your calculated column: ListName
Update XML would look like this:
<Batch OnError="Continue" RootFolder="/Lists/ListsName">
<Method ID='1' Cmd='New'>
You will have to create this xml in a variable and then use that variable in the updates (xml).
This is a concept and it should work with trial and error method...hope it helps you to get some direction or you may find that creating branches is easier.