> **Part 2 of [How To Use UpStream With WPForms](https://support.upstreamplugin.com/hc/upstream-plugin/articles/how-to-use-upstream-with-wpforms). Part 1 covers setup, connecting your form, and field types.**

## Using References To Set Milestones for Tasks And Other Properties

When you create tasks, milestones, files, and bugs using a form, they are automatically added to the parent project from the UpStream Forms XML. However, this method doesn’t allow you to attach a milestone to a task. In this section, we explain how to use references to do this.

In the following example, we create a project, task, and milestone. Since the task and milestone are under the project in the XML, they will be created within the project.

```

<upstream-forms-action>
	<form id="522">
		<project action="create" title="[1]" created-by="1">
			<milestone action="create" title="[11]" created-by="1">
			</milestone>
			<task action="create" title="[20]" created-by="1">
			</task>			
		</project>
	</form>
</upstream-forms-action>
```

The problem with this is that since the *&lt;milestone&gt;*tag and the *&lt;task&gt;*tag go directly beneath the *&lt;project&gt;*tag, there is no way to attach a task to a milestone.

To resolve this problem, we added references. When you create a project, task, milestone, file, or bug, you can provide a reference code, which can be used later in the XML to refer to the created item.

Let’s look at the following rewrite of the code above:

```

<upstream-forms-action>
	<form id="522">
		<project action="create" title="[1]" created-by="1">
			<milestone action="create" title="[11]" created-by="1" ref="my_milestone">
			</milestone>
			<task action="create" title="[20]" created-by="1">
				<field name="milestoneId" value="{my_milestone.id}"></field>
			</task>			
		</project>
	</form>
</upstream-forms-action>
```

On line 4, we have added *ref=”my_milestone”*. When the milestone is created, it is assigned to the reference *my_milestone.*That reference can be used in any future value field in order to reference the properties of *my_milestone.*

The most common use of references is to link a milestone to a task. In line 7, we use the reference to *my_milestone* to set the *milestoneId* for the task.

To use a reference in a value field, you need to enclose it with curly brackets. You can use most (but not all) of the properties below with references. So you can do something like this:

```

<upstream-forms-action>
	<form id="522">
		<project action="create" title="[1]" created-by="1">
			<milestone action="create" title="[11]" created-by="1" ref="my_milestone">
			</milestone>
			<task action="create" title="[20]" created-by="1">
				<field name="title" value="{my_milestone.title}"></field>
				<field name="milestoneId" value="{my_milestone.id}"></field>
			</task>			
		</project>
	</form>
</upstream-forms-action>
```

That sets the title of the new task to the same title as the milestone, and attaches the task to the milestone.

## Using WPForms To Edit Existing Projects/Tasks/Etc.

In addition to creating projects, milestones, tasks, bugs, and files with forms, you can also make edits.

To do this, you will need to create an XML that tells UpStream Forms what to edit based on ID. For example, here’s how to set the title of a task that already exists:

The first thing you will need to do is find the IDs of the task and the parent project. You can find project IDs in the list in your WordPress dashboard -&gt; Projects.

![Finding a project ID for use in an UpStream Forms XML file](https://support.kelsiem.com/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBbWdQIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--0b966c867eab7146aed099a51ea60cac5ce4a9fe/screenshot-2019-12-26-22-40-39-1-1024x672.png)

Finding a project ID for use in an UpStream Forms XML file

You can then find the IDs for tasks, milestones, files, and bugs next to the titles in edit project:

![Finding the ID of a milestone, task, bug, or file in UpStream](https://support.kelsiem.com/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBbW9QIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--1960a178cf9e50a86b45d123892c01338e0224f3/screenshot-2019-12-26-22-44-14-1024x630.png)

Finding the ID of a milestone, task, bug, or file in UpStream

Once you have all of the IDs, you can create the XML:

```

<upstream-forms-action>
	<form id="603">
		<project action="edit" id="600">
			<task action="edit" id="15dfd288c37033">
				<field name="title" value="[1]"></field>		
			</task>		
		</project>
	</form>
</upstream-forms-action>
```

In the example above, when the WPForms form with ID 603 is submitted, UpStream Forms will find the project with ID 600, and then its child task with ID 15dfd288c37033. It will then set the title of that task to whatever the form submitter entered in field #1.

Note the differences between this XML and the ones above. On lines 3 and 4, instead of using *action=”create”,*we use *action=”edit”*. We also provide the *id* instead of a title. When you use the *action=”edit”*command, you must provide an *id.* Also, notice that the *created-by*attribute is no included in this XML (it is only used when creating new items).

## List Of UpStream Object Properties

### Project Fields

| Field | Description | Field Type |
| --- | --- | --- |
| title | The title of the project. | Single Line Text |
| description | The description of the project. | Single Line Text or Paragraph Text |
| status | The status of the project. You will need to set this field up using the instructions above. | Dropdown or Multiple Choice |
| categoryIds | The IDs of the categories of this project. | Checkboxes, Dropdown, or Multiple Choice |
| assignedTo | The WordPress user ID of the owner of the project. You will need to create a dropdown or radio field using the instructions above. | Dropdown or Multiple Choice |
| assignedTo:byUsername | The WordPress username of the owner of the project. You will need to create a dropdown or radio field using the [instructions above](https://upstreamplugin.com/wp-admin/post.php?post=26559&action=edit#dropdown_assigned_user). | Dropdown or Multiple Choice |
| assignedTo:byEmail | The email of the WordPress user to set as the owner of the project. You will need to create a dropdown or radio field using the [instructions above](https://upstreamplugin.com/wp-admin/post.php?post=26559&action=edit#dropdown_assigned_user). | Dropdown or Multiple Choice |
| startDate | The start date of the project. | Date formatted as m/d/Y |
| endDate | The end date of the project. | Date formatted as m/d/Y |
| clientId | The client ID of the client to attach this project to. You will need to create a dropdown or radio field using the instructions above. | Dropdown or Multiple Choice |

### Task Fields

| Field | Description | Required Data Type |
| --- | --- | --- |
| title | The title of the task. | Single Line Text |
| notes | The notes for the task. | Single Line Text or Paragraph Text |
| status | The status of the task. You will need to set this field up using the [instructions above.](https://upstreamplugin.com/wp-admin/post.php?post=26559&action=edit#dropdown_status) | Dropdown or Multiple Choice |
| assignedTo | The WordPress user ID of the owner of the task. You will need to create a dropdown or radio field using the [instructions above](https://upstreamplugin.com/wp-admin/post.php?post=26559&action=edit#dropdown_assigned_user). | Dropdown or Multiple Choice |
| assignedTo:byUsername | The WordPress username of the owner of the task. You will need to create a dropdown or radio field using the [instructions above](https://upstreamplugin.com/wp-admin/post.php?post=26559&action=edit#dropdown_assigned_user). | Dropdown or Multiple Choice |
| assignedTo:byEmail | The email of the WordPress user to set as the owner of the task. You will need to create a dropdown or radio field using the [instructions above](https://upstreamplugin.com/wp-admin/post.php?post=26559&action=edit#dropdown_assigned_user). | Dropdown or Multiple Choice |
| milestoneId | The ID of the milestone this task is attached to. | Dropdown, Multiple Choice, or Reference |
| startDate | The start date of the task. | Date formatted as m/d/Y |
| endDate | The end date of the task. | Date formatted as m/d/Y |
| progress | The numerical progress percentage. UpStream only accepts integer multiples of 5 between 0 and 100. (Example: 0, 5, 10, 15, …) | Numbers, Dropdown, or Multiple Choice |

### Milestone Fields

| Field | Description | Required Data Type |
| --- | --- | --- |
| title | The title of the milestone. | Single Line Text |
| notes | The notes for the milestone. | Single Line Text or Paragraph Text |
| color | The color of the milestone. You will need to set this field up using the instructions above. | Dropdown or Multiple Choice |
| categoryIds | The category IDs of the milestone. | Checkboxes, Dropdown, or Multiple Choice |
| assignedTo | The WordPress user ID of the owner of the milestone. You will need to create a dropdown or radio field using the [instructions above](https://upstreamplugin.com/wp-admin/post.php?post=26559&action=edit#dropdown_assigned_user). | Dropdown or Multiple Choice |
| assignedTo:byUsername | The WordPress username of the owner of the milestone. You will need to create a dropdown or radio field using the [instructions above](https://upstreamplugin.com/wp-admin/post.php?post=26559&action=edit#dropdown_assigned_user). | Dropdown or Multiple Choice |
| assignedTo:byEmail | The email of the WordPress user to set as the owner of the milestone. You will need to create a dropdown or radio field using the [instructions above](https://upstreamplugin.com/wp-admin/post.php?post=26559&action=edit#dropdown_assigned_user). | Dropdown or Multiple Choice |
| startDate | The start date of the milestone. | Date formatted as m/d/Y |
| endDate | The end date of the milestone. | Date formatted as m/d/Y |

### File Fields

| Field | Description | Required Data Type |
| --- | --- | --- |
| title | The title of the file. | Single Line Text |
| description | The description of the file. | Single Line Text or Paragraph Text |
| assignedTo | The WordPress user ID of the owner of the file. You will need to create a dropdown or radio field using the [instructions above](https://upstreamplugin.com/wp-admin/post.php?post=26559&action=edit#dropdown_assigned_user). | Dropdown or Multiple Choice |
| assignedTo:byUsername | The WordPress username of the owner of the file. You will need to create a dropdown or radio field using the [instructions above](https://upstreamplugin.com/wp-admin/post.php?post=26559&action=edit#dropdown_assigned_user). | Dropdown or Multiple Choice |
| assignedTo:byEmail | The email of the WordPress user to set as the owner of the file. You will need to create a dropdown or radio field using the [instructions above](https://upstreamplugin.com/wp-admin/post.php?post=26559&action=edit#dropdown_assigned_user). | Dropdown or Multiple Choice |
| fileId | The WordPress media ID of the file. You will need to upload the file separately. | Dropdown, Multiple Choice, Number |

### Bug Fields

| Field | Description | Required Data Type |
| --- | --- | --- |
| title | The title of the bug. | Single Line Text |
| description | The description of the bug. | Single Line Text or Paragraph Text |
| dueDate | The due date of the bug. | Date formatted as m/d/Y |
| severity |  |  |
| status | The status of the bug. You will need to set this field up using the [instructions above.](https://upstreamplugin.com/wp-admin/post.php?post=26559&action=edit#dropdown_status) | Dropdown or Multiple Choice |
| assignedTo | The WordPress user ID of the owner of the bug. You will need to create a dropdown or radio field using the [instructions above](https://upstreamplugin.com/wp-admin/post.php?post=26559&action=edit#dropdown_assigned_user). | Dropdown or Multiple Choice |
| assignedTo:byUsername | The WordPress username of the owner of the bug . You will need to create a dropdown or radio field using the [instructions above](https://upstreamplugin.com/wp-admin/post.php?post=26559&action=edit#dropdown_assigned_user). | Dropdown or Multiple Choice |
| assignedTo:byEmail | The email of the WordPress user to set as the owner of the bug . You will need to create a dropdown or radio field using the [instructions above](https://upstreamplugin.com/wp-admin/post.php?post=26559&action=edit#dropdown_assigned_user). | Dropdown or Multiple Choice |
| fileId | The WordPress media ID of the attached file. You will need to upload the file separately. | Dropdown, Multiple Choice, Number |

## Using Custom Fields With Forms

To use UpStream custom fields with WPForms, you will need to supply the slug for each field as the field name in the XML. You can find the slug in the custom fields list under Projects -&gt; Custom Fields in your WordPress admin dashboard.

![image](https://support.kelsiem.com/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBbTRQIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--24aec468b1bf2cbc16b1adb8f5d13ae076fe01c1/screenshot-2019-12-27-21-30-17-1024x630.png)

Use the slug for a custom field as its field name in your XML

### Dropdowns

For dropdown or checkbox custom fields, you must enter the value in your WPForms field, as opposed to the label. You can see the correct field in the image below.

![image](https://support.kelsiem.com/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBblFQIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--35e2eaa0bce8d6a858a8a1af816ad178f4a8af98/screenshot-2019-12-27-22-42-40-1024x630.png)

The value in the red box in the picture above must exactly match the value in the red box in the picture below:

![image](https://support.kelsiem.com/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBbllQIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--8bd1be78dc77e9ae83a663abf129cc8f1d869381/screenshot-2019-12-27-22-45-02-1024x630.png)

Note that you can set the label and value to the same thing when you create your dropdown Custom Field to help with setup.

### User Fields

User custom fields work a lot like *assignedTo*above, but you can only use user IDs — not emails or user logins. If you choose allow multiselect within UpStream Custom Fields, this WPForms field should be a checkbox. Otherwise, it can be a dropdown or multiple choice.

Here’s an example form with users in WPForms:

![image](https://support.kelsiem.com/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBbklQIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--38006c39eb197596bd9fa49d31b278aad9ded1ca/screenshot-2019-12-27-22-33-53-1024x630.png)

Creating a user form with WPForms. Note that a numerical user ID is used as the value.

This field only accepts numerical user IDs, which you can find in WordPress. Here’s an example of the corresponding XML:

```

<upstream-forms-action>
	<form id="1054">
		<project action="create" title="p1" created-by="1">
			<task action="create" title="t1" created-by="1">
				<field name="user-check" value="[2]"></field>
			</task>			
		</project>		
	</form>
</upstream-forms-action>
```

### Country Fields

When you create a country field in WPForms, you will need to provide the 3 letter country code as the value for the form — not the country name. You can find the 3 letter country code [here](https://www.iban.com/country-codes).

Like some of the other custom fields above, the WPForms field type you use depends on whether you have set up the custom field in UpStream Custom Fields to allow multiple selections.

![Setting up a country field in WPForms. Make sure you use the 3 letter country code as the value, and not the country name.](https://support.kelsiem.com/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBbkFQIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--1e20990dae4b73d81ca2ff3f7dbda5d61aa9e010/screenshot-2019-12-27-22-29-16-1024x630.png)

Setting up a country field in WPForms. Make sure you use the 3 letter country code as the value, and not the country name.

Here’s an example of the XML that you would use with the form above.

```

<upstream-forms-action>
	<form id="1054">
		<project action="create" title="p1" created-by="1">
			<task action="create" title="t1" created-by="1">
				<field name="country-check" value="[1]"></field>
			</task>			
		</project>		
	</form>
</upstream-forms-action>
```
