Bluestep JS Documentation
    Preparing search index...

    Class Organization

    TODO

    TODO
    

    Hierarchy (View Summary)

    Index

    Other

    • Adds the key-value pair to the AltIds of this object. This will overwrite any existing value for the key on any object that has the same classId without warning you, so use this with caution.

      Parameters

      • key: string
      • value: string

      Returns void

    • Creates a Unit

      Parameters

      • unitName: string
      • supportEmail: string
      • contactName: string
      • contactAddress: string
      • contactPhone: string
      • contactEmail: string

      Returns Unit

      const newUnit = unit.addUnit(name, email, contactName, contactAddress, contactPhone, contactEmail);
      
    • Creates a Unit

      Parameters

      Returns Unit

      const pharmacyRepID = unit.addUnit({unitName: 'New Unit'});
      
    • An object of alternate ids for this object, with values as [[AltId]]

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

      // 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<Unit>

      // 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);
      
    • 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());
      
    • Gets the contact address that is set in Unit Information page.

      Returns string

      See [[contactName]]
      
    • Sets the Organization's contact's address.

      Parameters

      • address: string

      Returns void

    • Gets the contact email that is set in Unit Information page.

      Returns string


      B.email({
      to: unit.contactEmail(),
      subject: 'Updates Discussion',
      text: 'Please join us for a discussion about upcoming updates being deployed a week from today.',
      }).send()
      explore example
      [[Email]]
    • Sets the Organization's contact's email.

      Parameters

      • email: string

      Returns void

    • Gets the contact name that is set in Unit Information page.

      Returns string

      • 
        

      // assumes you have an array of units

      • const contactInfos = units.map(unit => {return {
      • unit: unit.Id(),
      • unitName: unit,
      • name: unit.contactName(),
      • address: unit.contactAddress(),
      • phone: unit.contactPhone(),
      • email: unit.contactEmail(),
      • }})
      
      
    • Sets the Organization's contact's name.

      Parameters

      • name: string

      Returns void

    • Gets the contact phone that is set in Unit Information page.

      Returns string

      See [[contactName]]
      
    • Sets the Organization's contact's phone.

      Parameters

      • phone: string

      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.`);
      
    • Gets the Default Domain configured in the Domain Manager for this unit.

      Returns string

      // assumes you have an array of units for your org
      const domains = units.map(u => {return {name: u, domain: u.defaultDomain()}});
    • 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();
      
    • Deletes this group Entry data, with the option to additionally delete the underlaying entries.

      Parameters

      • groupEntryDataId: string
      • OptionaldeleteConnectedEntries: boolean

        passing true will delete all associated entries; default is false

      Returns undefined

    • Deletes the group Entry data with the passed id, preserving the underlaying entries

      Returns undefined

    • 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>;
      
    • Gets the description that is set in Unit Information page.

      Returns string

      // assumes you have an array of descrptions for your org
      const descrptions = descrptions.map(d => {return {name: d, domain: d.description()}});
    • 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

    • Gets the domain url.

      Returns string

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

      Returns string

      const editBtn = `<button data-href="${baseObject.editUrl()}">Go to ${baseObject}</button>`;
      
    • Gets an array of all the object's ancestors.

      Returns EList<BaseObject<any>>

      const numberOfAncestors = obj.getAncestors().length;
      
    • Gets the HQ URL for the unit.

      Returns string

      There should be no new development in HQ sites.

      const hqURL = unit.hqUrl();
      
    • The [[Id]] of this object bounded to T.

      Returns Id<Unit>


      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();
      
    • Returns the Local Cache object for this Thread/Base Object.

      Returns LocalCache

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

      Returns Lock

    • Gets the Manage URL for the unit.

      Returns string

      const siteURLs = `<a href="${unit.manageUrl()}">Manage site</a><a href="${unit.hqUrl()}">Legacy Site</a>`;
      
    • 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]]
    • Same as calling optParent(var).orElse(null)

      Type Parameters

      Parameters

      • OptionalclassType: string | number

      Returns B

    • Gets the pharmacy id that is set in Unit Information page.

      Returns string

      const pharmacyID = unit.pharmacyId();
      
    • Gets the pharmacy rep id that is set in Unit Information page.

      Returns string

      const pharmacyRepID = unit.pharmacyRepId();
      
    • Gets the primary [[Relate.RecordContainer]] for the Unit. This holds all of the [[Relate.Record]]s for the Unit. It's used, e.g., on the Change Unit page.

      Returns [[RecordContainer]]

      const recordContainerId = unit.primaryRecordContainer().id()
      
    • Removes the AltId with the specified key from this object, if it has one. There is no error if the key does not exist.

      Parameters

      • key: string

      Returns void

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

      Returns void

    • Sets the units ability to show a manage link

      Parameters

      • active: boolean

      Returns void

    • Gets the support email that is set in Unit Information page.

      Returns string


      B.email({
      to: unit.supportEmail(),
      subject: 'We have a problem',
      text: 'Need your help. Please reply ASAP.',
      }).send()
      explore example
      [[Email]]
    • Sets the Organization's Email.

      Parameters

      • email: string

      Returns void

    • The [[Id]] or [[AltId]] that the system deems most relevant.

      Returns AltId<Unit> | Id<Unit>


      const displayDiv = `<div class="object-card" id="${baseObject.topId()}">
      <div class="title">${baseObject}</div>
      <div class="body">Hello World!</div>
      </div>;
    • 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

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

      Returns string

      const version = baseObject.version();
      
    • The versions of this object.

      Returns EList<BaseObject<Unit>>

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

    experimental

    • Creates a new group entry data object and applies it to a specific unit.

      	const { request, response } = B.net;

      const unitId = "111000___148502";
      allRes.currentUnit(unitId);

      allRes[0].unit()
      .addGroupEntryData({
      // id of the 'Group Entry'
      groupEntryId: '530101___1',
      // ids of all residents affected
      recordIds: ['1000002___1154989'],
      // key/value pairs where the key is the formula identifier of the field being updated
      commonFieldsData: { 'homePhone': '(801) 654-5978' }
      });

      Parameters

      Returns void

    • Applies updates to a group entry data object. You will get an error if the passed id is not found and/or if you pass fields that don't exist



      const { request, response } = B.net;
      const unitId = '111000___148502';
      allRes.currentUnit(unitId);

      allRes[0].unit()
      .updateGroupEntryData({
      groupEntryDataId: '530103___701', // id of the 'Group Entry Data'
      commonFieldsData: { 'homePhone': '(801) 654-5978' } // key/value pairs
      });

      Parameters

      Returns void