An AltId can be assigned to almost every object in the System to aid in generic/human-readable lookups.

System AltIds

The system processes IDs in the following order

  1. FID (Formula): Used to identify an entity for use in a formula. When you call require() off a query or form and pass nothing in, the system will automatically bind it to the context using the FID, i.e. you don't have to rename a query/form every time you use it in a formula. E.g. FID=nameForm
  2. SID (System): Used internally by BlueStep employees to help find things on the backend. E.g. SID=protected
  3. GID (Global): Used to identify an entity within one template. A template is the product you design for a specific section of the market (veternary clinic, assisted living, home insurance, sticky popcorn art). Many clients will have the same forms, reports, etc., but the UID of all of those will be different. Assigning a GID allows you to identify similar entities across different domains. E.g. GID=25001
  • BlueStep employees often use the [[Id.shortId]] of the first instance of that entity. If you have organizations A through Z and add a form in org E then copy it to the other orgs, the GID is derived from the shortId of the form in org E.
  1. UID (Unique): The system-assigned [[Id]]; not an AltId. UID will always be unique, even across domains. E.g. 1000003_U141114__25001

So if you pass in a GID, it will first check if it's an FID or SID, find it's a GID, then not even check to see if it's a UID.

Group IDs

If an AltId key is preceded with an underscore (_), it refers to a group of entites. For example, you might have an AltId called _frontDeskReports with values such as billing, clients, and appointments. You can call B.findAll('_frontDeskReports') and get all of them back in an array.

See [[B.find]] for an example of finding an object with its AltId.

Type Parameters

Hierarchy

  • Id<T>
    • AltId

Constructors

Methods

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

    Returns number

    Example

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

    Returns void

    Example

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

    Example

    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

    Example

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

    Example

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

    Returns boolean

    Example

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

    Returns string

    Example

    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

    Example

    
    
  • Returns the name (key) of the AltId.

    Returns string

    Example


    const altid = B.toAltId('animal', 'dog', 222222);
    const altIdName = altid.name(); // 'animal'```

    <dt>explore example</dt>[[toAltId]]
  • Get the [[Id]] object for the organization. Its [[classId]] will be 111111.

    Returns Id<Organization>

    Example

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

    Returns string

    Example

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

    Returns string

    Example

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

    Returns string

    Example

    console.log(id.u()); // 'U141114'
    
  • Returns the value of the AltId

    Returns string

    Example


    const altid = B.toAltId('animal', 'dog', 222222);
    const altIdValue = altid.value(); // 'dog'```

    <dt>explore example</dt>[[toAltId]]
  • Get the version number of the [[BaseObject]] associated with the [[Id]]. If the object has never been modified, will return 0.

    Returns number

    Example

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

Generated using TypeDoc