Bluestep JS Documentation

    Class Util

    TODO

    TODO
    
    Index

    Constructors

    Properties

    canonicalServerName: string

    B.util.canonicalServerName will tell you the fully qualified name of server this script is currently executing on.

    CssClasses: typeof CssClasses

    The [[CssClasses]].

    currentServer: string

    B.util.currentServer will tell you what server this script is currently executing on.

    hostAndNamespace: string

    B.util.hostAndNamespace will tell you the host.namespace of server this script is currently executing on.

    namespace: string

    B.util.namespace will tell you the fully qualified name of server this script is currently executing on.

    Optional: typeof Optional

    TODO

    staticPath: string

    Returns the static prefix to access static content. Using this prefix will allow the content to be served cached by the browser. This is equivalent \/static/${B.util.version}`` right now. However this may change in the future to a CDN.

    UUID: UUID

    Returns a UUID/GUID object. These are system generated universally unique identifiers.

    version: string

    Returns Bluesteps running version

    Methods

    • Manually removes a key from the cache. This is useful when you need a query removed from the cache before a commit.

      Type Parameters

      Parameters

      Returns void

    • Convenience method. It just calls B.util.cacheRemove(B.util.toId(id)).

      Parameters

      • id: string

      Returns void

    • A restricted function that clears this organizations data from the cache. Use carefully, as clearing the Cache will cause immediate slowdowns to an organization.

      Returns void

      B.clearCache();
      
    • Used for updating the running formula.

      Parameters

      • fnc: () => void

      Returns void

    • Create an [[Alert]]. For details see [[AlertBuilder]]. The fields: type, message, and endDate are required.

      Parameters

      • Optionalsettings: AlertSettings

        Settings object contain field necessary to create the Alert. If parameter is not specified a builder is returned.

      Returns Alert | AlertBuilder

      Create an alert using a settings object.

      const alert = B.createAlert({
      type: 'auto',
      message: 'Hello World',
      endDate: B.time.Instant.now()
      });

      Create an alert using a builder.

      const alert = B.createAlert()
      .type('signature')
      .message('Hello World')
      .endDate(B.time.Instant.now())
      .create();
    • Disables the saving of Change History

      Parameters

      • fnc: () => void

      Returns void

      B.disableChangeHistory(() => {
      //Do updates here and change history will not be saved.
      });
    • Creates an [[Email]] object to send an email.

      Parameters

      Returns Email

      B.email({
      to: 'user@email.host',
      subject: 'test',
      text: 'Hello World'
      }).send();
      B.email()
      .to('user@email.host')
      .subject('test')
      .text('Hello World')
      .send();
    • Returns a java HashMap<U, T>

      Type Parameters

      • U
      • T

      Returns Java.Map<U, T>

    • Returns a java HashSet

      Type Parameters

      • T

      Returns Set<T>

    • Returns true if the current users is debugging the current formula.

      Returns boolean

    • Test whether a string is an [[Id]] string

      Parameters

      • id: string

        The string to test

      Returns boolean

      const isId = B.isId('test'); // false
      
    • Tests the given string and determines if it is valid JSON.

      Parameters

      • potentialJsonString: string

      Returns boolean

      const isValid = B.util.isValidJson("{\"some\":\"thing\"}");
      
    • Turns a javascript Object into a Java.Map<String, T>

      Type Parameters

      • T

      Parameters

      • Optionalmap: { [key: string]: T }

      Returns Java.Map<String, T>

    • Converts a Map<string, T> to an object.

      Type Parameters

      • T

      Parameters

      • map: Map<String, T>

      Returns { [key: string]: T }

    • Creates a new java BigDecimal object from the given value.

      Parameters

      • value: string | number

      Returns BigDecimal

      const bigDecimal = B.util.newBigDecimal("123.45");
      
    • Creates a new java BigInteger object from the given value.

      Parameters

      • value: string | number

      Returns BigInteger

      const bigInteger = B.util.newBigInteger("123456789012345678901234567890");
      
    • Returns a new Calendar object with the current time.

      Parameters

      Returns Calendar

    • Returns a Java Properties Object

      Parameters

      • Optionalmap: { [key: string]: any } | Java.Map<any, any>

      Returns Java.Map<any, any>

    • Provides you the id of the currently running Script

      Returns string

    • Super User Only.

      Returns any

    • Creates an [[Shlink]] object to generate a short link.

      Parameters

      Returns Shlink

    • Delays the continued execution of this thread for the specified number of milliseconds. While this method certainly has its uses, it is generally not recommended for use in most scripts; since it is easy to be tempted to use it to "bandaid" design flaws.

      Parameters

      • duration: number

      Returns void

      console.log("I'm executed now");
      B.delay(10000);
      console.log("I'm executed ten seconds later");
    • Creates an [[TextMessage]] object to send an Text.

      Parameters

      Returns TextMessage

      const ptoDate = pto.fields.date.val();
      const mPhone = contactInfo.fields.phone.val();
      B.util.text({
      message: 'Your PTO ${ptoDate} was approved',
      to: mPhone,
      unit: pto.formRecord().record().unit().id().longId(),
      id: contactInfo.id().toString()
      }).send();
    • Convert the name and value and the class type to an [[AltId]]

      Type Parameters

      Parameters

      • name: string

        The AltId's name.

      • value: string

        The AltId's value.

      • classType: string | number

        Value representing the class type of AltId

      Returns AltId<B>

      const altid = B.toAltId('animal', 'dog', 222222);
      
      const altid = B.toAltId('animal', 'dog', 'myassn.user.User');
      
    • If a short id is passed it uses the classIfIdIsShortId to identify its class. Otherwise what ever class stored in the id is used.

      Type Parameters

      Parameters

      • IdOrSortId: string

        Value representing an full or short id.

      • classIfIdIsShortId: string | number

      Returns Id<B>

      const id = B.toAnyId('5', 222222);
      
      const id = B.toAnyId('5', 'myassn.user.User');
      
    • Does it best to change the value to a Host Object. A conversion will be tried for Objects and Arrays. If it or a member can't be converted then toString() will be used for the value.

      Returns any

    • Convert a full or short id and its class type to an [[Id]]

      Type Parameters

      Parameters

      • id: string

        Value representing an full or short id.

      • OptionalclassType: string | number

        Required when id represents a short id.

      Returns Id<B>

      const id = B.toId('222222___5');
      
      const id = B.toId('5', 222222);
      
      const id = B.toId('5', 'myassn.user.User');
      
    • Convert a full or short id and its class type to an Id object, or null if it doesn't exist.

      Type Parameters

      Parameters

      • id: string

        string representing a full id.

      Returns Id<B>

      const id = B.toIdOrNull('222222___5');
      
    • Returns a UUID/GUID string. This is the same as calling B.util.UUID.randomUUID().toString();

      Returns string

    MMNEPVFCICPMFPCPTTAAATR