Same as calling optAncestor(var).orElse(null)
If this object is a Collection it returns it as an array. The majority of objects in the system are Collections. For most objects, this is the same as calling [[children]].
Get the children of the object. This retrieval goes one level deep.
Optional
classType: string | numberClear the field's value.
// This is a surprisingly non-trivial example.numberField.val() > 10 && numberField.clear();// There are many things going on here:
// 1) We are performing a check that a value even exists in this field. If not, nothing happens.
// 2) If the first condition is met, we then check that the value is a number or a string representing a number
// (remember: '5'==5 in JavaScript), and that it is greater than 10. If not, nothing happens.
// 3) If the first two conditions are met, the field is then cleared of its value.
The "created at" timestamp of this object.
The creator of this object.
Set the date using [[Java.Time.LocalDate]], [[Java.Time.Instant]], or a number of milliseconds from epoch. The second parameter is optional and is to specify the zoneID of the area in question. If omitted or null, the system will assume the user's timezone. The timezone is used to find the start-of-day, to store in relate.
The deleted children of this object. Only looks one level deep. E.g. a form's deleted children could include fields and form entries. A folder's deleted children could include folders, forms, and formulas, but not any of those forms' entries.
The default display name of this object. For the most part, this is the same as calling toString()
, which is the same as inserting the object into a string.
Sets the Display Name.
Returns this field's [[FormMetaData]] object.
Gets an array of all the object's ancestors.
Returns the Local Cache object for this Thread/Base Object.
Same as calling optLock().orElse(null)
Optional
options: stringReturns the [[FieldMetaData]] object that this describes this field.
The [[User]] that last modified this object.
Optional value for this field. Same as [[valOpt]]. Try to use this as often as you can over val()
; Null-pointer exceptions can be a pain, and this will provide a measure of safety. Try to reserve val()
for situations where a field is required and you know that the value cannot be null.
A [[Java.Optional]] of the ancestor with the specific class.
A [[Java.Optional]] of the current object's parent object.
Optional
classType: string | numberSame as calling optParent(var).orElse(null)
Optional
classType: string | numberGet the field's value, or else it will return null. This is the same as calling opt().orElse(null)
without typescript complaining.
In many cases, this is also the same as simply calling val()
, however some field implementations wish to
employ defaults, such as text fields that return an empty string if they are null.
Reset the current object so that it is cleared from the cache and looked up from the database.
Makes changes to the database for this object
Gets the field's value if there is one, and will otherwise return null. Some overrides of this method have default return-values for convenience but, that would not make sense for this: the general-use case. In situations where the value might be null
(e.g. non required field), consider using optional chaining: field.val()?.toString()
.
The preferred method to handle null
s in bs.js is simply [[opt]]/[[valOpt]]; as the methods available off of that can handle virtually any situation.
This is identical to calling field.opt().orElse(null)
.
Set the field's value.
The value to be put into the field.
The versions of this object.
Returns a view URL for this object, if it has one. This value is always a relative URL, meaning it does not contain the protocol prefix or domain name such as http://xyz.bluestep.net
.
A [[Field]] for date data with no accompanying time data. However, in the database it's stored as a date with zeroed-out time (i.e. midnight).
See also [[TimeField]], [[DateTimeField]]
Example: ```javascript // trying to get the seconds will fail const date = field.val(); const year = date.getYear(); const month = date.getMonth() const day = date.getDayOfMonth(); const seconds = date.getSeconds(); // Uncaught TypeError: field.getSeconds is not a function ```