hasItem (NotesXspDocument - JavaScript)

Checks if the document contains an item.

Syntax

hasItem(fieldName:string) : boolean
Parameter Description
fieldName The name of the item.
Return value Description
boolean true if the document contains the item; false otherwise.

Examples

This computed field returns the value of an item in the document associated with the current XPage if the item exists.
if(document1.hasItem("number")) {
	return document1.getItemValueDouble("number").toString();
} else {
	return "number does not exist"
}