Lotus Script Trick: Remove The Duplicate Values From a Profile field in a Profile Document


The following function removes the duplicate values from a profile field, or any multi-value field (FieldName), in a profile document or a regular notes document.

Function RemoveDuplicateValue(Source As NotesUiDocument, FieldName As String)
Dim Indexresult As Variant
Dim UniqueArr As Variant
Indexresult=Source.Document.GetItemValue(FieldName) ”Get the field values into array
UniqueArr= Arrayunique(Indexresult,1) ”Copy array but with unique items only.

Call Source.Document.ReplaceItemValue(FieldName, UniqueArr) ”Update the field with this unique array.
End Function

Leave a Reply

Your email address will not be published. Required fields are marked *