Uidoc.refresh syntax

The code below works to create a new document in the personal address book and copy fields from my butchered addressbook. (aka rolodex). I appreciate the help I received on this last night.

I have a new problem in that I need to refresh the new document after it’s saved so that the Blackberry software recognizes it. I recognize that I need to rewrite this to use uidoc.refresh but I cannot get the syntax right.

I think I may need to start over.

Before I do that does anyone have any sugestions?

I recognize that the GetNthDocument(n) is not the most efficient and I’ll change it before this goes into the production environment.

Thanks for your time.

Dim s As NotesSession

Dim sourcedb As NotesDatabase

Dim destdb As NotesDatabase

Dim sourcenote As NotesDocument

Dim sourceview As NotesView

Dim destnote As NotesDocument

Dim destview As NotesView

Dim documents As NotesDocumentCollection

Dim Item as Notesitem

Sub Initialize

Set s = New NotesSession

Set sourcedb = s.CurrentDatabase

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

Set destview = destdb.GetView(“($Users)”)

Set sourceview = sourcedb.GetView(“($Users)”)

Set documents = sourcedb.UnprocessedDocuments

If documents.Count = 0 Then Exit Sub

DocsCopied = 0

For n = 1 To documents.Count

Set sourcenote = documents.GetNthDocument(n)

ProcessDocument

If StopProcessing Then Exit For

Next

End Sub

Sub ProcessDocument

Set destnote=destdb.createdocument

Set item = sourcenote.GetFirstItem(“Firstname”)

Call item.copyitemtodocument(destnote, “Firstname”)

Set item = sourcenote.GetFirstItem(“Lastname”)

Call item.copyitemtodocument(destnote, “Lastname”)

Set item = sourcenote.GetFirstItem(“StreetAddress_Pr_Bu”)

Call item.copyitemtodocument(destnote, “OfficeStreetAddress”)

destnote.Type=“Person”

destnote.form=“Person”

destnote.save True,False

End Sub

Subject: uidoc.refresh syntax

If I understand your post correctly, you are saying that there is some stuff being done in the UI that makes a document appear in a way that Blackberry recognizes. Correct?

If so, you will not need uidoc.refresh, unless you are really creating a document in the UI, which you are not.

If your form uses translations/validations to convert certain values, you may get away with using the notesDocument.ComputeWithForm method, check out the help file.

If not, you will need to do those calculations yourself directly in the back-end.

What is it, exactly, that makes Blackberry recognize the document? Is it the way certain documents are presented in certain views? If so, check the column formulas for that view and make sure you update your documents accordingly.

Once you have figured that out, it should be easy to fix.

Subject: RE: uidoc.refresh syntax

Thanks,

I think that may take care it. I will not be able to test it until Tuesday.

I appreciate your help.