IsValid (NotesDocument - JavaScript)

Read-only. Indicates whether a Document object represents an existing document (not a deletion stub) initially.

Defined in

NotesDocument

Syntax

isValid() : boolean
Legal value Description
true if the document represents an existing document
false if the document is a deletion stub

Usage

This property is set once and reflects the state of the document when the Document object is created. Use isDeleted to see if a valid document is deleted while you are working on it.

Examples

This button gets the subject item for all documents in the database checking to ensure the documents are valid and not deletion stubs.
var db:NotesDatabase = session.getDatabase("Sales1/Acme", "west\\sales", false);
if (db == null) {
	requestScope.status = "Cannot open NotesUA/Westford/Notes//bobtest\\DatabaseEtc";
	return;
}
var dc:NotesDocumentCollection = db.getAllDocuments();
if (dc.getCount() == 0) {
	requestScope.status = "No documents in database";
	return;
}
requestScope.status = "Documents in database:";
var doc:NotesDocument = dc.getFirstDocument();
while (doc != null) {
	if (!doc.isValid()) {
		var subject = "[document is not valid]";
	} else if (doc.isDeleted()) {
		subject = "[document is deletion stub]";
	} else {
		subject = doc.getItemValueString("subject");
	}
	requestScope.status += "\n" + subject;
	var tmpdoc = dc.getNextDocument(); doc.recycle(); doc = tmpdoc;
}