Search code examples
xpagesxpages-ssjsdomino-designer-eclipsessjs

NotesException: Unknown or unsupported object type in Vector


I'm trying to add new names to the address book programmatically but I'm getting the following error:

[TypeError] Exception occurred calling method NotesDocument.replaceItemValue(string, Array) Unknown or unsupported object type in Vector

Code snippet below:

var addressBook = session.getDatabase("","names.nsf");
var gView:NotesView = addressBook.getView("($VIMGroups)");
var gDoc:NotesDocument = gView.getDocumentByKey("groupName", true);

var newg:java.util.Vector = [];
var mems:java.util.Vector = new Array(gDoc.getItemValue('Members'));
newg.push(mems);

var newNames:java.util.Vector = new Array(getComponent("NewMems").getValue());
newg.push(newNames);

gDoc.replaceItemValue("Members", newg);
gDoc.save();

Adding a single user works fine, but then it does not save users in the required canonical format below:

CN=John Doe/O=Org

Instead it is saved in the original format below:

John Doe/Org

I look forward to your suggestions. Thanks.


Solution

  • You can't store an Array in a field. Make newg a java.util.Vector instead and integrate with that.

    For OpenNTF Domino API the team wrote a lot of code to auto-convert to Vectors, which may cover Arrays.