getProfileDocument (NotesDatabase - JavaScript)

Retrieves or creates a profile document.

Defined in

NotesDatabase

Syntax

getProfileDocument(profile:string, profilekey:string) : NotesDocument
Parameter Description
profile The name or an alias of the profile form.
profilekey The unique key associated with the profile document.
Return value Description
NotesDocument The profile document for the specified key, or a new profile document if the document with the key does not exist.

Examples

This button gets a profile document given a key name (the query) and displays the value of its email item.
var name:string = requestScope.query;
if (name.isEmpty()) {
	requestScope.status = "No name specified";
	return;
}
var doc:NotesDocument = database.getProfileDocument("email", name);
var email:string = doc.getItemValueString("email");
if (email.isEmpty()) {
	requestScope.email = "No email";
} else {
	requestScope.email = email;
}
This button gets a profile document given a key name (the query) and sets the value of its email item.
var name:string = requestScope.query;
if (name.isEmpty()) {
	requestScope.status = "No name specified";
	return;
}
var email:string = requestScope.email;
if (email.isEmpty()) {
	requestScope.status = "No email specified";
	return;
}
var doc:NotesDocument = database.getProfileDocument("email", name);
doc.replaceItemValue("email", email);
doc.save();