Bluestep JS Documentation
    Preparing search index...

    Class Id<T>

    How entities are identified in the system. Can by either system or user assigned. When an ID is system-assigned, it is also referred to as UID. See [[AltId]] for an explanation of FID, SID, GID, and UID.

    Regex representation: /[[classId]]_[[u]]?_[[AltId.name]]?_+([[shortId]]|[[AltId.value]])/

    e.g. 123456_U123456__1

    explore example
    [[B.queries]], [[Relate.QueryMetaDatas.byFID]], [[Relate.QueryMetaData.require]], [[BaseObject.id]]

    Type Parameters

    Hierarchy (View Summary)

    Index

    Constructors

    Methods

    • Get the class Id. First member in [[Id]]. Of the form /[0-9]{6,7}/ (e.g. 123456).

      Returns number

      console.log(id.classId()); // '1000001'
      
    • Clear the [[BaseObject]] from the cache.

      Returns void

      // you store time information about each object and want to clear them if they're older than 5 seconds
      console.log(objList)
      // [{id: id1, timestamp: 1555100262645},{id: id2, timestamp: 1555100277174}]
      const cleanupObj = objList => {
      const expTime = new Date().getTime() - 5000;
      for (const obj of objList) obj.timestamp < expTime && obj.id.clearCache();
      }
      setInterval(cleanupObj(objList),5000);
      // gonna be honest, setInterval doesn't exist in bluestep.js because it's part of the WindowOrWorkerGlobalScope namespace in JS
    • Get [[BaseObject]] associated with the [[Id]]. Akin to [[B.find]].

      Returns T

      const itemCreator = itemId.find().creator().fullName();
      
      explore example
      [[BaseObject.creator]], [[User.fullName]]
    • Get the global Id, which is defined as an [[AltId]] with the [[AltId.name]] of 'GID'.

      Returns string

      // see if any forms' GIDs are overlapping
      B.queries.byFID['allUsers'].require();
      const gidSet = new Set();
      for (const user in allUsers) {
      const gid = user.id().globalId();
      gidSet.has(gid) ? console.log(`${user} GID is duplicate`) : gidSet.add(gid);
      }
      explore example
      [[B.queries]], [[Relate.QueryMetaDatas.byFID]], [[Relate.QueryMetaData.require]], [[User.id]]
    • Check whether an [[Id]] is valid. New Ids with a [[shortId]] of 0 are not valid.

      Returns boolean

      TODO
      
    • Check whether an [[Id]] is versioned. Will be true if the object has been modified.

      Returns boolean

      console.log(newObject.isVersioned()); // false
      console.log(existingObject.isVersioned()); // true
    • Get the long Id.

      Returns string

      console.log(id.longId()); // '1100002_U123456__5'
      
    • Check if [[Id]]s are equal regardless if they are [[AltId]] variations. This is like a double equals whereas [[equals]] is like a triple equals.

      Parameters

      • otherId: Id<any>

      Returns boolean

      
      
    • Get the [[Id]] object for the organization. Its [[classId]] will be 111111.

      Returns Id<Organization>

      const orgId = user.id().orgId() // '111111___141114'
      
    • Get the short Id. Last member of [[Id]]. Comes in many forms.

      Returns string

      console.log(id.shortId()); // '1100002'
      
    • Returns the standard System ID. That is ClassID___ShortID.

      Returns string

      
      
    • Get the organization U-identifier. Of the form /U[0-9]{5,6}/ (e.g. U123456).

      Returns string

      console.log(id.u()); // 'U141114'
      
    • Get the version number of the [[BaseObject]] associated with the [[Id]]. If the object has never been modified, will return 0.

      Returns number

      console.log(newObject.version()); // 0
      console.log(existingObject.version()); // 12