SnTT: Public Access forms and Shared Fields

For the last month or so, I have been heads down developing and testing a new released I am about to migrate into production.  Last week, I ran into a little problem that I thought I would document.

In the new release of our product, I incorporated a number of shared fields into each form.  Some of these forms are set to allow public access users to use them so that they are available to Anonymous users.  In testing, it was discovered that Anonymous users couldn't access these forms any more.  After searching the net, I found the answer in a forum posting.

It seems that the Shared Fields do not have the $PublicAccess flag set by default.  In fact, there is no way to do it through the Domino Designer IDE. To fix the problem, I modifed a script I found in the Domino forum to set the flag on all the shared fields:

Sub Initialize
 Dim doc As NotesDocument
 Dim db As notesdatabase
 Dim dc As notesdocumentcollection
 Dim nc As NotesNoteCollection
 Dim session As New notessession
 Dim szString As String
 
 On Error Goto errorproc
 
 Set db = session.CurrentDatabase
 Set nc = db.createnotecollection( False )
 nc.SelectSharedFields = True
 Call nc.BuildCollection
 szString = nc.GetFirstNoteId
 
 While szString ""
  Set doc = db.GetDocumentByID( szString )
  doc.replaceItemValue "$PublicAccess", "1"
  doc.sign
  doc.save True, False
  szString = nc.GetNextNoteId( szString )
 Wend
 
finish :
 Exit Sub
 
errorproc :
 Call LogError()
 Resume finish
End Sub

With the flag set, the forms opened exactly like they should.

 

<< Previous Document / Next Document >>
  • 1) good find! - Charles Robinson
    Created 4/4/2007 11:54:16 AM email | website

    It's nice to know about this before it turns around and bites me. :-)

Post A Comment
Subject: (required)
Name: (required)
Email: (required)
Web Site:
Comment:(No HTML - Links will be converted if prefixed http://)

Remember Me?