Skip to content

Model Object

propertyIsPresent()

propertyIsPresent() — returns boolean

Available in: model Category: Miscellaneous Functions

Returns true if the specified property exists on the model and is not a blank string. This is the inverse of propertyIsBlank() which checks that a property is either missing or empty.

NameTypeRequiredDefaultDescription
propertystringyesName of property to inspect.
1. Property exists with a value
employee = model("employee").new();
employee.firstName = "Dude";
writeOutput(employee.propertyIsPresent("firstName")); // true

2. Property exists but is blank
employee.firstName = "";
writeOutput(employee.propertyIsPresent("firstName")); // false

3. Property does not exist on the model
writeOutput(employee.propertyIsPresent("nonexistentProperty")); // false

4. Conditional logic
if (!employee.propertyIsPresent("email")) {
    writeOutput("Email is required.");
}