getItemValueString (NotesDocument - JavaScript)

Returns the value of an item with a single text value.

Defined in

NotesDocument

Syntax

getItemValueString(name:string) : string
Parameter Description
name The name of the item.
Return value Description
string The value of the item.

Usage

If multiple items have the same name, this method returns the value of the first item.

If the item has no value or the value is numeric or date, this method returns an empty string.

If no item with the specified name exists, this method returns an empty string. It does not throw an exception. Use hasItem to verify the existence of an item.

This method returns a rich text item rendered to plain text. Formatting and embedded objects are lost.

If the item has multiple values, this method returns the first value.

Examples

This button gets the value of a string item in the current document.
var itemname:string = "subject";
var doc:NotesDocument = currentDocument.getDocument();
if (doc.hasItem(itemname)) {
	var itemvalue:string = doc.getItemValueString(itemname);
	if (itemvalue.length > 0) {
		requestScope.status = itemvalue;
	} else {
		requestScope.status = itemname + " is empty or not a string"
	}
} else {
	requestScope.status = itemname + " does not exist";
}