Bluestep JS Documentation
    Preparing search index...

    Class RelationshipField

    [[RelationshipField]] are represented using a custom data type.

    Hierarchy (View Summary)

    Index

    Constructors

    Methods

    • An object of alternate ids for this object, with values as [[AltId]]

      Returns { [name: string]: AltId<RelationshipField> }

      // you've marked certain forms with the FID of deprecated and want to filter for those
      const warningMessage = baseObject.altIdsObject().FID.value().includes('deprecated') && 'Please use a different form';
    • An object of alternate ids for this object, with values as strings

      Returns { [name: string]: string }

      // you've marked certain forms with the FID of deprecated and want to filter for those
      const warningMessage = baseObject.altIds().FID.includes('deprecated') && 'Please use a different form';
    • An array of alternate ids for this object.

      Returns EList<RelationshipField>

      // you've marked certain forms with the FID of deprecated and want to filter for those
      const warningMessage = baseObject.altIds().FID.includes('deprecated') && 'Please use a different form';
    • Same as calling optAncestor(var).orElse(null)

      Type Parameters

      Parameters

      • classType: string | number

      Returns B

    • 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]].

      Returns EList<BaseObject<any>>

      const ids = obj.asArray().map(ob => ob);
      
    • An array of [[RelationshipFormEntry]] containing the list of options have become newly selected or unselected as part of the current edit. This field is of the same type as the options field, but contains a different list of options. Note, that the changed values will usually be in either the selected or original option lists, but those list also contain options that have not been changed. Namely, options which are in both the selected and original lists, will probably not be in the changed list...that is unless they have been deselected then reselected. A similar condition can occur for options that have been selected then deselected

      Returns EList<RelationshipFormEntry>

    • Get the children of the object. This retrieval goes one level deep.

      Parameters

      • OptionalclassType: string | number

      Returns EList<BaseObject<any>>

      const childrenNames = obj.children().map(child => child.displayName());
      
    • Sets all options to unchecked. A convenience method for setAll(false).

      Returns void

    • The "created at" timestamp of this object.

      Returns Instant

      const createdAt = `<div class="created-at">${baseObject.created()}</div>`;
      
    • The creator of this object.

      Returns User

      alert(`Guess who created this. It was ${baseObject.creator().fullName()}. They are to blame.`);
      
    • 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.

      Returns EList<BaseObject<any>>

      const deleted = baseObject.deletedChildren();
      
    • Returns a delete URL for this object, else a blank string. Following the URL will delete the object, so proceed with caution.

      Returns string

      const deleteBtn = `<button data-href="${baseObject.deleteUrl()}">Go to ${baseObject.displayName()}</button>;
      
    • 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.

      Returns string

      The following assumes you have already aggregated a selection of baseObjects into an array

      const displayNames = [];
      for (const o of baseObjects) displayNames.push(o.displayName());
      const namesList = `<ul><li>${displayNames.join('</li><li>')}</li></ul>`;
    • Sets the Display Name.

      Parameters

      • name: string

      Returns void

    • Returns an edit URL for this object, else a blank string.

      Returns string

      const editBtn = `<button data-href="${baseObject.editUrl()}">Go to ${baseObject}</button>`;
      
    • Returns this field's [[FormMetaData]] object.

      Returns FormMetaData

      const form = firstName.form();
      const fieldNames = [];
      for (field in form) fieldNames.push(form[field].displayName());
    • Gets an array of all the object's ancestors.

      Returns EList<BaseObject<any>>

      const numberOfAncestors = obj.getAncestors().length;
      
    • The [[Id]] of this object bounded to T.

      Returns Id<RelationshipField>


      const displayDiv = `<div class="object-card" id="${baseObject.id()}">
      <div class="title">${baseObject}</div>
      <div class="body">Hello World!</div>
      </div>;
    • Returns whether the object is locked or not.

      Returns boolean

      Part of the [[Lock]] API.

      const isLocked = baseObject.isLocked();
      
    • Returns whether the object is pending a lock or not.

      Returns boolean

      Part of the [[Lock]] API.

      const isPendingLock = baseObject.isPendingLock();
      
    • Returns whether the object is pending an unlock or not.

      Returns boolean

      Part of the [[Lock]] API.

      const lockPendingUnlock = baseObject.isPendingUnLock();
      
    • This function checks if entry is selected, given the id of the entry. The result of this function is a optional boolean value indicating one of three things: A value of true means the id is selected; a value of false means it is not selected; a value of empty means there is a configuration problem such as [[isSelected]] being called on an empty object or the id is not a potential selection.

      Returns boolean

    • Method indicates whether the current entry is valid to be a part of a relationship. If the current entry is not valid, then 'options' will always be empty since there will be no entries which can form a fully valid relationship with this record.

      Returns boolean

    • Returns whether the field is writable

      Returns boolean

      const firstNameClass = firstName.isWritable() ? 'active' : 'inactive';
      
    • Returns the Local Cache object for this Thread/Base Object.

      Returns LocalCache

    • Same as calling optLock().orElse(null)

      Returns Lock

    • Parameters

      • Optionaloptions: string

      Returns string

    • Returns the [[FieldMetaData]] object that this describes this field.

      Returns FieldMetaData<any>

      const firstNameClass = firstName.metaData().styleClass();
      
      explore example
      [[FieldMetaData.styleClass]]
    • The modified date of this object.

      Returns Instant

      const isModified = baseObject.modified();
      
    • The [[User]] that last modified this object.

      Returns User

      const modifierName = baseObject.modifier().fullName();
      
    • A [[Java.Optional]] of the ancestor with the specific class.

      Parameters

      • classType: string | number

      Returns Optional<BaseObject<any>>

      const ancestors = obj.optAncestor(1000001).ifPresent(a => console.log('${a} exists'));
      
      explore example
      [[Java.Optional.ifPresent]]
    • Returns the [[Lock]]

      Returns Optional<Lock>

      Part of the [[Lock]] API.

      const lockExpire = baseObject.optLock();
      
    • A [[Java.Optional]] of the current object's parent object.

      Parameters

      • OptionalclassType: string | number

      Returns Optional<BaseObject<any>>

      const ancestors = obj.optAncestor(1000001).ifPresent(a => console.log('${a} found'));
      
      explore example
      [[Java.Optional.ifPresent]]
    • An array of [[RelationshipFormEntry]] containing the list options that were selected at the beginning of the current edit. This field is of the same type as the options field, but contains a different list of options. Note, that the formerly selected values may not be currently valid, and therefore may not be in the options list. Also, the originally selected items may or may not be currently selected.

      Returns EList<RelationshipFormEntry>

    • Same as calling optParent(var).orElse(null)

      Type Parameters

      Parameters

      • OptionalclassType: string | number

      Returns B

    • Reset the current object so that it is cleared from the cache and looked up from the database.

      Returns void

    • An array of [[RelationshipFormEntry]] containing the list options that are currently selected. This field is of the same type as the options field, but contains a different list of options. Note, that the currently selected values may not be currently valid, and therefore may not be in the list.

      Returns EList<RelationshipFormEntry>

    • Sets or clears the relationship to another entry, given the id of the entry. It is only available when the relationship field is editable. Returns true if successful. A retrurn of false means it was unsuccessful because, for instance, the id doesn't belong to the target form.

      Parameters

      Returns boolean

    • Set all options to either checked or unchecked.

      Parameters

      • Optionalselected: boolean

        Defaults to true

      Returns void

      // select all OptionItems
      selectField.setAll(true);
    • Returns the bluestep.js classpath for the current object.

      Returns string

      const isBool = testForm.fields.mysteryField.typeName().toLowerCase().includes('boolean')
      
    • Makes changes to the database for this object

      Returns void

    • Optional value for this field. Alias for [[opt]].

      Returns Optional<any>

      date.valOpt().map(val => `Report Date: ${val}`).orElse('No Date');
      
      explore example
      [[Java.Optional.map]], [[Java.Optional.orElse]]
    • Returns string

    • The version of this object or empty string if it doesn't exist.

      Returns string

      const version = baseObject.version();
      
    • 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.

      Returns string

      const viewBtn = `<button data-href="${baseObject.viewUrl()}">Go to ${baseObject.displayName()}</button>;