IBM®
Skip to main content
    Country/region select      Terms of use
 
 
   
     Home      Products      Services & solutions      Support & downloads      My account     

developerWorks  >  Lotus  >  Forums & community  >  Best Practice Makes Perfect

Best Practice Makes Perfect

A collaboration with Domino developers about how to do it and how to get it right in Domino

I finally got tired of people whining that there was no way to make a view of profile documents. So, I created a way, which you can download from here -- no charge. It's a form which, when you open it, gets a list of all profile documents in the current database and shows them, letting you select one to edit, or multiple to delete. You can click the column headings to sort.

Profile document management screen

The edit function depends on having an appropriately named form or subform; if a subform, the thing opens in a dialog. Either way, you can save your changes. If you end up with duplicate-named profiles, you can still edit them all, but this tool will tell you if you're editing in the "normal document" way rather than via EditProfile (the latter will of course only work for one of the duplicates).

The delete has a confirmation, so that you don't permanently delete all your profiles by accident.

You can just paste this form into any application, and it should work in 6.0 on up (though 8.0 has a more efficient way to get the list of profile documents, which this code will take advantage of, if available). As usual, this is provided "as is," but if you run into any difficulties please let me know here.

The form is set to appear in the Create / Other dialog, so you can get to it without adding an action or outline entry, though of course it's a good idea to do that. I just wanted to have minimum effort to add it to an application.

I'm a big fan of profile documents, both for performance and because they make it simple to centralize configuration functions on a single screen. This tool should, I think, remove one more objection to their use. Along with the practice I mentioned earlier of checking for profile document existence in the database Postopen code before trying to use it, I see no reason anyone would want to use a dumb old lookup document for keyword lists, default rich text values, and so on, anymore.

P.S. Yes, Jamie, I know NoteMan will do the same thing with more features for free, but I wanted something that would be part of the application so that people wouldn't complain about all the developers having to install it. Huh.

Andre Guirard | 28 April 2008 05:15:00 AM ET | Home, Plymouth, MN, USA | Comments (23)


 Comments

1) A tool to manage profile documents
Dennis van Remortel | 4/28/2008 5:23:54 AM

Superb André!!

2) A tool to manage profile documents
Nathan T. Freeman | 4/28/2008 8:50:15 AM

"I see no reason anyone would want to use a dumb old lookup document for keyword lists, default rich text values, and so on, anymore."

Because you have information stored in more than one NSF, of course.

/me points finger at Andre for being stuck in the "single NSF" mindset.

3) A tool to manage profile documents
Jaime | 4/28/2008 11:30:38 AM

No finger pointing, but I stay away from Profile Documents because (on the web) the caching is horrible. Changes sometimes even require a reboot of the HTTPTask.

4) A tool to manage profile documents
Ernie Mercer | 4/28/2008 2:04:35 PM

Many thanks for such a useful utility!

5) A tool to manage profile documents
David Leedy | 4/28/2008 2:24:17 PM

I love using profile documents for setup things, but I typically don't use them for keyword lookups. Between test databases, templates, production databases, etc... it's really nice to be able to go into a view and just copy certain keyword documents from database to database. States for example.... If all the keyword documents we in profile documents then you'd need to copy a field at a time....

And as Nathan said, it's sometimes nice to have a a global lookup database.... but since that's one more database you have to make sure laptop users replicate I often end up maintaining some of this lists in various databases.

6) A tool to manage profile documents
Joseph LeMay | 4/28/2008 3:18:29 PM

wow. I had profile documents in one database from people that left 5 years ago. Thanks for the form.

7) A tool to manage profile documents
harkpabst meliantrop | 4/29/2008 1:27:03 AM

What's so hard about this line:

Set notesDocument = notesDatabase.GetProfileDocument( profilename$ [, uniqueKey$ ] )

Brilliant tool. A perfect showcase for the power that stems from Notes' simplicity. I love it.

8) Thanks
Patrick Kwinten | 4/29/2008 3:57:18 AM

I am glas dome people frustrated you otherwise you would not created this functionn =)

9) A tool to manage profile documents
Erik Brooks | 4/29/2008 8:03:43 AM

Count me in on the finger-pointing.

Take a multi-NSF app, and push the same profile doc to each NSF. Voila! Defaults, paths, global settings, etc. are all wrapped up nice and neat in a format accessible *very quickly* to each DB.

The caching is part of what makes them so attractive. Profile docs read VERY fast. The things I mentioned (defaults, paths, etc.) typically don't *change* often in most apps but do get *accessed* frequently. A heavily-cached, easily accessible document is exactly the place to store them.

I'll take an @GetProfileField over an @DbLookup any day unless it's absolutely critical that I have the most up-to-date info possible.

10) A tool to manage profile documents
Erik Brooks | 4/29/2008 8:04:40 AM

@3 - Oh, and I should say that they're also brilliant (when used correctly) for web use.

11) A tool to manage profile documents
Ben Poole | 4/30/2008 10:39:13 AM

What a fantastic tool, thanks Andre!

I've come round to using profile documents for central application set-up type stuff (as others point out, database paths and dimilar settings rarely change), but I still prefer to configure keyword look-ups the old way for transparency's sake, if nothing else.

In fairness to developers, profile documents were so horrible in the Notes 4.x timeframe (and 3.x? I can't remember if they existed then...), many of us took our sweet time to come back round to them ;o)

The web application aspect can be a problem too.

12) Nice
Jamie Magee | 5/21/2008 5:44:39 PM

Yeah, NoteMan always worries me in an end-user's toolbar since they can use it to modify anything on a doc (including stuff you don't want them to change) without going through the form. Too much power for them. I will start referring developers to add your form to their apps for end users, and thanks for mentioning NoteMan for the more technical usage scenarios.

13) A tool to manage profile documents
Dwain A Wuerfel | 11/24/2008 1:01:34 PM

This looks like another awesome tool from Andre.

I have the following 2 lines of code setup to use a centralized support application to overcome the template, development, archive, and production issues. The actpa is a variable provided via a selection list.

Set profdoc = support_nsf.GetProfileDocument("Profile", actpa)

Set uidoc = ws.EditDocument( True , profdoc , False , "" , True , True )

I have had problems with this when trying to create a profile document that doesn't currently exist. How can this be modified to eliminate the issue?

14) Editing a profile that doesn’t yet exist
Andre Guirard | 1/12/2009 11:43:31 AM

Dwain, what sorts of problems? I don't see why what you're doing shouldn't work.

15) Background Colors
David C Slatter | 4/9/2009 12:55:28 PM

How are you seting the backgroud color of the text/hotspot?

16) Little correction ?
Norbert Goeth | 5/11/2009 6:15:10 AM

Brilliant, wonderful stuff. And with the example comes also a progress bar which does not disturb debugging and brings all the comfort you ever wished.

When I tested the tool I recognized, that in a lot of profile documents the username-key did not start with CN=... but with N=... So I extended the search for the abbreviated name to a second try.

Function NameAbbr(x As String) As String

' Return the abbreviated version of a canonical name

Dim nn As New notesname(x)

Dim xtry As String

NameAbbr = nn.Abbreviated

' in a lot of profiledocuments the key does not start with "CN=...", but with "N=..." In this case we make a second try

If NameAbbr=x And Ucase(Left(x,2))="N=" Then

xtry=NameAbbr("c" & x)

If xtry="c" & x Then

NameAbbr=x

Else

NameAbbr=xtry

End If

End If

End Function

17) Error when profile document collection is exceeded: Profile document enumeration pool is full
Jim Romaine | 7/2/2009 9:34:47 AM

Thanks for the tool.

It helped point me in the right direction to resolve the error "Profile document enumeration pool is full", (yes, there were a lot of unneeded profile documents being generated. That's a different issue.) was which was to use NotesNoteCollection.

I played around with the tool to get it work by putting in some arbitrary limits (1000 profile documents returned), but I am guessing this could be trapped if needed.

18) Technotes related to the issue Profile document enumeration pool is full
Jim Romaine | 7/2/2009 9:36:44 AM

Forgot the technotes related to the issue above:

{ Link }

{ Link }

Thanks again.

19) Question about this tool...
Damian Podeszwa | 8/2/2010 9:34:43 AM

Hi,

it seems that this tool is very nice. Maybe I am missing something, but... how to use it? I am not developer, but I see only empty database. I used the Create / Other but it doesn't work for me.

Thanks in advance for support.

Damian.

20) Question about this tool...
Damian Podeszwa | 8/2/2010 9:47:22 AM

Forget it - I found how to do this ;-)

21) I can’t open
ichi Olocco | 11/14/2010 12:27:03 PM

Could you send in the blank nsf

Thanks

22) I can resolve it
Ichi Olocco | 11/14/2010 12:32:06 PM

Forget It... I can open it :)

23) Question about this tool
Ganesh | 9/12/2013 9:32:00 AM

Will this tool help to get more than 50,000 profile documents in db???

because we have more than 50,000 profile documents created in db. now i have remove all profiles docs..

24) Deleting mass numbers of profile documents
Andre Guirard | 9/13/2013 2:40:42 PM

To work with thousands of profile documents, you don't want to have any manual steps; you should script it. You can use this code to see how to get all the profile documents, but after that, you should just use the methods of NotesDocumentCollection and NotesDocument to do whatever it is you wanted to do.

 Add a Comment
Subject:
   
Name:
Comment:  (No HTML - Links will be converted if prefixed http://)
 
Remember Me?     Cancel

Search this blog 

Disclaimer 

    About IBM Privacy Contact