Manage Learn to apply best practices and optimize your operations.

Using names.nsf undocumented features

Have you ever wanted to use the "Select Names" Web dialog, as seen in names.nsf and webadmin.nsf in R6.x, in your own R6 Web applications? This tip shows you how to do it.

View member feedback to this tip.

Have you ever wanted to use the "Select Names" Web dialog, as seen in names.nsf and webadmin.nsf in R6.x, in your own R6 Web applications? This tip shows you how to do it.

  1. Add the following code to the form "HTML Head Content" section:
    _tDb := "names.nsf";
    _is6 := @TextToNumber
    (@Version) < 171;
    
    "<meta http-equiv='expires' 
    content='0'>
    <script>
            var sElementType = 
    'document';
     var sDocType = 'group';
     var sDBFileName = '" + _tDb + "'; 
     var sDocUNID = '" + 
    @Text(@DocumentUniqueID) + "';
     var sDefaultView = 'Groups';
     var sWebDbName = '/" + _tDb + "/';
     var isDom6  = " + 
    @If(_is6 ; "true"; "false") + ";
    </script>" +
    @If(_is6;
     "<script src='/" + _tDb + 
    "/WebJSTools?
    OpenJavaScriptLibrary'></script>
      <script src='/" + _tDb + 
    "/WebJSNavigationTools?
    OpenJavaScriptLibrary'></script>";
     "<script src='/" + _tDb +
     "/WebJSNavigationTools5?
    OpenPage'></script>"
    )

  2. Create a field (preferably of Names type) on your form to receive the entries selected by the user in the dialog.

  3. Add computed text to the right of the field created in step 2 with the following value:
    REM { Use Web Address 
    dialog from names.nsf };
    
    @If(@ClientType = "Notes"
     | !@IsDocBeingEdited; @Return(""); "");
    
    _tLabelOneItem := "name";
    
    REM {DNT};
    _tFieldName := "CREditAccess_T";
    _tDb     := "names.nsf";
    
    "<a onclick="
    
     initTools();
    
     var hDlg = window.hDlgAddrMulti;
    
     hDlg.sMsgOneEntry = '"+ 
    _tLabelOneItem +"';
     hDlg.hDestField = 
    document.forms[0]." + _tFieldName + ";
     hDlg.dlOpen();
    
     return false;
    
    " href=""><img src="/" + 
    _tDb + "/btnPicker.gif?OpenImageResource" 
    width="15" height="11" border="0"
     alt=""></a>"

  4. Change the "_tFieldName" variable in the code above to the name of the field you created in step 2. This field will receive entries selected in the Web dialog.

Enjoy!

MEMBER FEEDBACK TO THIS TIP

Good job. I love when somebody finds a simple but effective solution that can help a lot. It helps in creating a more user-friendly application, and even helps developers to look for a way how to do it next time.

—Petr H

******************************************

Things to bear in mind for this tip are as follows:

  • Ensure that the Maximum Internet Access on the ACL for names.nsf is set to Editor (not Reader as mine was – is this the default?).
  • Ensure the receiving field on the form is Editable (not Computed – sort of logical I guess but I was expected the value to be set using JavaScript).
  • Change the "<177" to ">177" to correctly identify Notes version 6.
  • Change the double quote surrounding the onClick event on the <a> to backslash double quote or else the compiler complains. You may also have to change all double quotes within that event to single quotes.

When this has been done, it works (a bit slowly in populating the list, but it saves me coding!). I haven't fully tested the multiple selection of names (they won't fit into a standard field, of course), and I need to see how they end up in a stored document -- but it's a start!

Also, if you change the agent "wReadAddressData" in the NAB in the initialize section thus:

'add entry to the list
Set nmUser = New NotesName(Cstr(vweDir.ColumnValues(3))) 
'RSB: Was column 2 (not 3), which gave the e-mail address. What we need is the Notes address, column 3.

You can get it to return Notes Names rather than e-mail addresses. You'll probably want to either change the template or clone, and amend the code to call another agent with this change, rather than change the original -- but you get the drift….

—Ralph B.

******************************************

This tip is very nice. But the computed text's value has a problem and to correct it is not nice. Here is the right one:

REM { Use Web Address dialog 
from names.nsf }; 

@If(@ClientType = "Notes" 
| !@IsDocBeingEdited; @Return(""); ""); 

_tLabelOneItem := "name"; 

REM {DNT}; 
_tFieldName := "CREditAccess_T"; 
_tDb     := "names.nsf"; 

"<a onclick=\" 

 initTools(); 

 var hDlg = window.hDlgAddrMulti; 

 hDlg.sMsgOneEntry = '"+ 
_tLabelOneItem +"'; 
 hDlg.hDestField = 
document.forms[0]." + _tFieldName + "; 
 hDlg.dlOpen(); 

 return false; 

\" href=\"\"><img src=\"/" + 
_tDb + "/btnPicker.gif?
OpenImageResource\" 
width=\"15\" height=\"11\" 
border=\"0\" alt=\"\"></a>"

I tried this, and it works well.

—Oya K.

Do you have comments on this tip? Let us know.

This tip was submitted to the SearchDomino.com tip exchange by member Christian Cloutier. Please let others know how useful it is via the rating scale below. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.

Dig Deeper on HTML for Lotus Notes Domino

SearchWindowsServer

Search400

  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/Search400.com community. These cheat ...

  • HTML cheat sheet

    This is a really cool cheat sheet if you're looking to learn more about HTML. You'll find just about everything you every wanted ...

  • Carol Woodbury: Security

    Carol Woodbury

SearchDataCenter

SearchContentManagement

Close