Move an Item to a Folder using List XML Variable
- Last UpdatedJun 25, 2024
- 3 minute read
You can move an item to a list folder using list XML variable. This can be done using Update Variable activity and List Navigator activity.
Scenario
An organization has got multiple departments. Each employee information needs to be moved into the respective department folder under the Employee List. If the folder does not exist, the respective department folder needs to be created under the Employee List.
Follow the steps below to move an item to a list folder.

-
Create a list called Employee, with fields as shown below.
- Title
- Name
- Department
- Experience
- - Company
- - Years
-
Go to Enterprise Console -> Workflows. Create a List Workflow and associate it to the OnCreate event of Employee List.
-
In the Process Designer, right click the Start activity and select Activity Properties from the options.
-
Click the Set Variables button in the XMLVariables field.
-
Create a new variable EmployeeDepartment of type XML List. Select the Employee list from the Select List dropdown. The XML variable scope should be set as New. [This XML variable is used in the workflow to check the existence of department folder, and create a new department folder if not found in the Employee List].
-
Drag and drop the List Navigator activity from the List Activities category. List Navigator activity is used to navigate to the folder to which list item is to be moved. You need to set the following properties:
XmlVariable of List Type - You need to select the XML variable - EmployeeDepartment created in the Start activity.
Folder Name - Select the department folder name to which the list item is to be moved.
Scope - The scope should be set as New.
Enable Errors Encountered Output - It should be set as No.
-
You can set different paths for outputs - Action Completed and Folder Not Found. Action Completed output is given by the activity if the XML variable has navigated to the folder specified. Folder Not Found is given by the activity when the folder is not found in the list. [Folder Not Found output is given by the activity only when the Enable Error Encountered Output property is set as No].
-
Create the department folder in the list, when the output is Folder Not Found. Drag and drop Update Variable activity. Click the Set Variables icon in the Set Variables field.
-
Set the title field of EmployeeDepartment list XML variable to department folder name and System:Internal -> SaveAs -> AsFolder to true.
-
When the folder is found (i.e. Action Completed output), drag and drop Update Variable activity. Click the Set Variables button in the Set Variables field.
-
Click the Select link and then click the drop-down list that appears. Set the System:Internal -> Operations -> MoveToFolder with the department name of the employee. [This is to be done on the list XML variable that points to the employee added].
-
Click OK to save the settings.
-
Publish the workflow.
-
Create a new item in the list.
-
The workflow gets triggered. The department name folder gets created in the Employee List and the employee information moves under the respective department folder.