Appending to object list

Does anybody know how to append to an object list ?


to append an object to an object list, I’m creating a kind of buffer and passing it as parameter to the component called pub.list:appendToDocumentList. Example:
let’s suppose we have a document with a document list with the following fields: A,B and C. To append an information to this document list you just have to create a temporary document (buffer) with the same fields and same types. So, the temporary document will have A, B and C fields.
After this you use the pub.list:appendToDocumentList in this way:

the parameter toList receives the document List you have
the parameter fromItem receives the temporary document (buffer)
the parameter fromList doesn’t receive nothing

the output parameter named as toList, you have to assign it to your document list.


Kleber Ferreira

Hi Kleber,
Thanks for you reply.
I am able to append Documents to Document Lists.
I have a problem when I try to append a Object to a Object List.
If I try using pub.list:appendToDocumentList for appending to Object Lists I get a blank document list as an output.
Basically I am looking for something like pub.list:appendToObjectList, which does not exist now and I am sure there must be a reason why .

I would suggest writing a java service.

Ok Shubhro,

just to test and find out if you can change your document like this:
instead of objectList try document list instead and each field of this document will be an object…
After this you can try the pub.list:appendToDocumentList
I hope it could help you…


Kleber Ferreira

I had tried appending to a document list each of whose field is an object, and that works.
But again, it gives me a document list, not an object list .
I think, as Adnan suggested, a java service is the way to go.
If anybody already has it, it would be great if it can be shared.


maybe you can mix the solutions:
you can create a Java service in order to convert a document list in a object list…


Kleber Ferreira


Check out this PSUtilities.misc.appendObjectList method.


QN, thanks a ton. This package is a goldmine.

Keep in mind that all the wM-supplied “appendTo*List” methods are very inefficient when the lists become large. I’ve observed speed issues when the list reaches about a thousand entries (your mileage will vary based on many factors). If you know your list will grow only to a couple thousand entries or less, then using appendTo… will be fine. If it can grow to much more than that, then you’ll need to write Java services to place objects in a java.util.LinkedList or other appropriate Collection and when the list is fully populated, convert it to an Object List (an array of Java Objects) in the pipeline for subsequent looping/processing.