---
title: Adding Two Sub-Items for an Argument
slug: adding-two-sub-items-for-an-argument
docTags: 
createdAt: 2026-06-11T23:09:16.539Z
---

## Overview

You can add multiple child values to a job argument by creating a list item with `AddListValue()` and then setting values on the returned XML element.

## Use Case

Use this approach when an argument needs to contain multiple sub-items within a list entry.

## Example

```csharp
using System;
using Innovation.Activate;
using System.Xml;

class Script : ScriptBase
{
    public void main()
    {
        Job j = new Job();

        // Mark the argument as a list
        j.Arguments.SetValue("badJobNumbers/@list", "1");

        // Create a new list item
        XmlElement n = j.Arguments.AddListValue("badJobNumbers/item", "");

        // Add child values to the list item
        XmlValue.Set(n, "badNumber", "123");
        XmlValue.Set(n, "message", "Eat breakfast");

        Trace.WriteLine(j.Arguments.FormattedXml);
    }
}
```

## Resulting XML

```xml
<badJobNumbers list="1">
  <item>
    <badNumber>123</badNumber>
    <message>Eat breakfast</message>
  </item>
</badJobNumbers>
```

## Key Points

- `AddListValue()` creates a new item in a list argument and returns the corresponding `XmlElement`.
- `XmlValue.Set()` adds or updates child elements within the list item.
- Set the `@list` attribute to `"1"` to indicate that the argument contains a list.
- Use `FormattedXml` to inspect and verify the final argument structure.
