Scipts to change Location Doc

Hi

I need to create a button so that when user clicks it. It will change the field “Passthru Server” in the Location document.

Does anyone have a sample script on this?

Thanks so much.

Subject: Scipts to change Location Doc

Hope you can use this… It is unsupported, if it works great - if it doesn’t then too bad :slight_smile:

Function ClientReplaceLocationField(szFieldName As String, szNewValue As String)

'Function that replaces the value in a field on the users current location document

Dim sess As New NotesSession

Dim db As NotesDatabase

Dim dbCur As NotesDatabase

Dim view As NotesView

Dim entryset As NotesViewEntryCollection

Dim entry As NotesViewEntry

Dim doc As NotesDocument

Dim szCurLoc As String

Set db = New NotesDatabase(“”, “names.nsf”)

Set dbCur = sess.CurrentDatabase

Set view = db.GetView(“Locations”)

Set entryset = view.AllEntries

Set entry = entryset.GetFirstEntry

szCurLoc = sess.GetEnvironmentString(“location”, True)

szCurLocArr = Split(szCurLoc, “,”)

Do Until entry Is Nothing

Set doc = entry.Document



'Uncomment the If and End If below if you wish to update all location documents

If doc.GetItemValue("name")(0) = szCurLocArr(0) Then	'This is the current location document

	Call doc.ReplaceItemValue(szFieldName, szNewValue)

	Call doc.Save(True, False, True)  

End If

Set entry = entryset.GetNextEntry(entry)

Loop

End Function