Sub changeField _
( doc As NotesDocument, oldName As String, _
newName As String )
If doc.HasItem( oldName ) Then
Call doc.ReplaceItemValue( newName, _
doc.GetItemValue( oldName ) )
Call doc.RemoveItem( oldName )
Call doc.Save( False, True )
End If
End Sub
For example, to change the name of the phone item to officePhone without losing the item's value, a script makes the following call:
Dim doc as NotesDocument
'...set value of doc...
Call changeField( doc, "phone", "officePhone" )