Adding Two Sub-Items for an Argument
4 min
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 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 \<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