getDocumentByID (NotesDatabase - JavaScript™)
Finds a document in a database, given the document note ID.
Defined in
NotesDatabaseSyntax
getDocumentByID(noteid:string) : NotesDocument
Parameter | Description |
---|---|
noteid |
The note ID of a document. |
Return value | Description |
---|---|
NotesDocument |
The document whose note ID matches the parameter. |
Usage
For an explanation of note IDs, see the NoteID property in NotesDocument.If you get a note ID from @NoteID, delete the "NT" prefix.
An exception occurs if the note ID is invalid.
Examples
This button gets a document given its Note ID.try {
var noteid:string = requestScope.query;
if (noteid.startsWith("NT")) { // in case it comes from @NoteID
noteid = noteid.substring(3);
}
var doc:NotesDocument = database.getDocumentByID(noteid);
requestScope.status = doc.getItemValueString("subject");
} catch(e) {
requestScope.status = "Invalid note ID";
}