Skip to main content link. Accesskey S
  • Help
  • IBM Logo
  • IBM Notes and Domino Application Development wiki
  • All Wikis
  • All Forums
  • THIS WIKI IS READ-ONLY. Learn more...
  • Home
  • Product Documentation
  • Community Articles
  • Learning Center
  • IBM Redbooks
  • API Documentation
Search
Community Articles > Developing Applications > Developing XPage Applications > NotesName sample JavaScript code for XPages
  • Share Show Menu▼
  • Subscribe Show Menu▼

About the Original Author

Click to view profileIBM contributorRobert Perron
Contribution Summary:
  • Articles authored: 24
  • Articles edited: 12
  • Comments Posted: 7

Recent articles by this author

NotesName sample JavaScript code for XPages

Here is sample JavaScript code for the class NotesName. Eventually this sample code will find its way into the documentation. Corrections and comments are appreciated.

NotesMIMEEntity sample JavaScript code for XPages

Here is sample JavaScript code for the class NotesMIMEEntity. Eventually this sample code will find its way into the documentation. Corrections and comments are appreciated.

NotesViewEntryCollection sample JavaScript code for XPages

Here is sample JavaScript code for the class NotesViewEntryCollection. Eventually this sample code will find its way into the documentation. Corrections and comments are appreciated.

NotesViewNavigator sample JavaScript code for XPages

Here is sample JavaScript code for the class NotesViewNavigator. Eventually this sample code will find its way into the documentation. Corrections and comments are appreciated.

NotesViewEntry sample JavaScript code for XPages

Here is sample JavaScript code for the class NotesViewEntry. Eventually this sample code will find its way into the documentation. Corrections and comments are appreciated.
Community articleNotesName sample JavaScript code for XPages
Added by IBM contributorRobert Perron on March 29, 2011 | Version 1
expanded Abstract
collapsed Abstract
Here is sample JavaScript code for the class NotesName. Eventually this sample code will find its way into the documentation. Corrections and comments are appreciated.
ShowTable of Contents
HideTable of Contents
    • 0.1 Abbreviated
    • 0.2 Addr821
    • 0.3 Addr822Comment1
    • 0.4 Addr822Comment2
    • 0.5 Addr822Comment3
    • 0.6 Addr822LocalPart
    • 0.7 Addr822Phrase
    • 0.8 ADMD
    • 0.9 Canonical
    • 0.10 Common
    • 0.11 Country
    • 0.12 Generation
    • 0.13 Given
    • 0.14 Initials
    • 0.15 IsHierarchical
    • 0.16 Keyword
    • 0.17 Language
    • 0.18 Organization
    • 0.19 OrgUnit1
    • 0.20 OrgUnit2
    • 0.21 OrgUnit3
    • 0.22 OrgUnit4
    • 0.23 Parent
    • 0.24 PRMD
    • 0.25 Surname

Abbreviated


This computed field returns John B Goode/Sales/East/Acme/US.

var nam:NotesName = session.createName(
	"CN=John B Goode/OU=Sales/OU=East/O=Acme/C=US");
return nam.getAbbreviated();


This computed field returns the canonical hierarchical name of the current user.

return session.getUserNameObject().getAbbreviated();


Addr821


This computed field returns jbgoode@us.acme.com.

var nam:NotesName = session.createName(
	"\"John B Goode\" <jbgoode@us.acme.com> (Guitars) (Music) (East)");
return nam.getAddr821();


Addr822Comment1


This computed field returns Guitars.

var nam:NotesName = session.createName(
	"\"John B Goode\" <jbgoode@us.acme.com> (Guitars) (Music) (East)");
return nam.getAddr822Comment1();


Addr822Comment2


This computed field returns Music.

var nam:NotesName = session.createName(
	"\"John B Goode\" <jbgoode@us.acme.com> (Guitars) (Music) (East)");
return nam.getAddr822Comment2();


Addr822Comment3


This computed field returns East.

var nam:NotesName = session.createName(
	"\"John B Goode\" <jbgoode@us.acme.com> (Guitars) (Music) (East)");
return nam.getAddr822Comment3();


Addr822LocalPart


This computed field returns jbgoode.

var nam:NotesName = session.createName(
	"\"John B Goode\" <jbgoode@us.acme.com> (Guitars) (Music) (East)");
return nam.getAddr822LocalPart();


Addr822Phrase


This computed field returns "John B Goode".

var nam:NotesName = session.createName(
	"\"John B Goode\" <jbgoode@us.acme.com> (Guitars) (Music) (East)");
return nam.getAddr822Phrase();


ADMD


This computed field returns acmeadmd.

var nam:NotesName = session.createName(
	"CN=John B Goode/OU=Sales/OU=East/O=Acme/C=US/A=acmeadmd/P=acmeprmd");
return nam.getADMD();


Canonical


This computed field returns CN=John B Goode/OU=Sales/OU=East/O=Acme/C=US.

var nam:NotesName = session.createName(
	"CN=John B Goode/OU=Sales/OU=East/O=Acme/C=US");
return nam.getCanonical();


This computed field returns the canonical hierarchical name of the current user.

return session.getUserNameObject().getCanonical();


This computed field also returns the canonical hierarchical name of the current

user.

return session.getUserName();


Common


This computed field returns John B Goode.

var nam:NotesName = session.createName(
	"CN=John B Goode/OU=Sales/OU=East/O=Acme/C=US");
return nam.getCommon();


This computed field returns jbgoode.

var nam:NotesName = session.createName(
	"jbgoode@us.acme.com");
return nam.getCommon();


This computed field returns the canonical hierarchical name of the current user.

return session.getUserNameObject().getCommon();


This computed field also returns the canonical hierarchical name of the current

user.

return session.getCommonUserName();


Country


This computed field returns US.

var nam:NotesName = session.createName(
	"CN=John B Goode/OU=Sales/OU=East/O=Acme/C=US/A=acmeadmd/P=acmeprmd");
return nam.getCountry();


Generation


This computed field returns Jr.

var nam:NotesName = session.createName(
	"CN=John B Goode/OU=Sales/OU=East/O=Acme/C=US/S=Goode/G=John/I=B/Q=Jr");
return nam.getGeneration();


Given


This computed field returns John.

var nam:NotesName = session.createName(
	"CN=John B Goode/OU=Sales/OU=East/O=Acme/C=US/S=Goode/G=John/I=B/Q=Jr");
return nam.getGiven();


Initials


This computed field returns B.

var nam:NotesName = session.createName(
	"CN=John B Goode/OU=Sales/OU=East/O=Acme/C=US/S=Goode/G=John/I=B/Q=Jr");
return nam.getInitials();


IsHierarchical


This computed field returns the From item from a mail message but only the common

name if it is hierarchical.

if (currentDocument.hasItem("From")) {
	var from:NotesName = session.createName(
		currentDocument.getItemValueString("From"));
	return from.isHierarchical() ? from.getCommon() : from.getCanonical();
} else {
	return "Not a mail message";
}


Keyword


This computed field returns US\Acme\East\Sales.

var nam:NotesName = session.createName(
	"CN=John B Goode/OU=Sales/OU=East/O=Acme/C=US");
return nam.getKeyword();


Language


This computed field returns fr-CA.

var nam:NotesName = session.createName(
	"CN=John B Goode/OU=Sales/OU=East/O=Acme/C=US", "fr-CA");
return nam.getLanguage();


Organization


This computed field returns Acme.

var nam:NotesName = session.createName(
	"CN=John B Goode/OU=Sales/OU=East/O=Acme/C=US");
return nam.getOrganization();


OrgUnit1


This computed field returns East.

var nam:NotesName = session.createName(
	"CN=John B Goode/OU=Sales/OU=East/O=Acme/C=US");
return nam.getOrgUnit1();


OrgUnit2


This computed field returns Sales.

var nam:NotesName = session.createName(
	"CN=John B Goode/OU=Sales/OU=East/O=Acme/C=US");
return nam.getOrgUnit2();


OrgUnit3


This computed field returns Music.

var nam:NotesName = session.createName(
	"CN=John B Goode/OU=Guitars/OU=Music/OU=Sales/OU=East/O=Acme/C=US");
return nam.getOrgUnit3();


OrgUnit4


This computed field returns Guitars.

var nam:NotesName = session.createName(
	"CN=John B Goode/OU=Guitars/OU=Music/OU=Sales/OU=East/O=Acme/C=US");
return nam.getOrgUnit4();


Parent


This computed field returns the effective user name for the parent of a NotesName

object defined elsewhere on the page.

var nam:NotesName = requestScope.nam;
return nam.getParent().getEffectiveUserName();


PRMD


This computed field returns acmeprmd.

var nam:NotesName = session.createName(
	"CN=John B Goode/OU=Sales/OU=East/O=Acme/C=US/A=acmeadmd/P=acmeprmd");
return nam.getPRMD();


Surname


This computed field returns Goode.

var nam:NotesName = session.createName(
	"CN=John B Goode/OU=Sales/OU=East/O=Acme/C=US/S=Goode/G=John/I=B");
return nam.getSurname();
expanded Attachments (0)
collapsed Attachments (0)
expanded Versions (2)
collapsed Versions (2)
Version Comparison     
VersionDateChanged by              Summary of changes
2Mar 30, 2011, 9:32:20 AMRobert Perron  IBM contributor
This version (1)Mar 29, 2011, 3:01:09 PMRobert Perron  IBM contributor
Copy and paste this wiki markup to link to this article from another article in this wiki.
Go ElsewhereStay ConnectedHelpAbout
  • IBM Collaboration Solutions wikis
  • IBM developerWorks
  • IBM Software support
  • Twitter LinkIBMSocialBizUX on Twitter
  • FacebookIBMSocialBizUX on Facebook
  • ForumsLotus product forums
  • BlogsIBM Social Business UX blog
  • Community LinkThe Social Lounge
  • Wiki Help
  • Forgot user name/password
  • About the wiki
  • About IBM
  • Privacy
  • Accessibility
  • IBM Terms of use
  • Wiki terms of use