API Docs for: 1.0.0
Show:

CWTKnowledgeUtil Class

Class to help with manipulation and information retrieval from Knowledge base records and their related classes, such as Categories and Articles.

Example Uses:

  • var owner = CWTKnowledgeUtil.negotiateCategoryOwnership("35669ac2dbe9bb008408d12c5e961941", gs.getProperty("knowledge_base.managers_group"));

Constructor

CWTKnowledgeUtil

(
  • knowledge_base
)

Parameters:

Methods

isFalse

(
  • value
)
Boolean

Determine if a value should be considered true.

Due to a variety of ways of true/false values being returned by service now, this method exists to level set to a JavaScript boolean value for use.

Parameters:

Returns:

Boolean:

True if the value is considered as trying to be "true", false otherwise.

isFalse

(
  • value
)
Boolean

Determine if a value should be considered false.

Due to a variety of ways of true/false values being returned by service now, this method exists to level set to a JavaScript boolean value for use.

Parameters:

Returns:

Boolean:

True if the value is considered as trying to be "false", false otherwise.

negotiateCategoryOwnership

(
  • category
  • [notify]
  • [table]
  • [field]
  • [field]
)
GlideRecord static

If the category has an owner and that owner is active, that owner is returned. If that owner is not active, the Category's parent is checked. This active/parent check continues until an active owner is found and returned, or null is returned for no active owner could be found.

Parameters:

  • category GlideRecord | String

    The record or System ID of the Category to check.

  • [notify] GlideRecord | String optional

    Indicates the group to notify, if any, when no owner can be determined. Uses the System Property "knowledge_base.notify_table" to determine what table the notification is created against.

  • [table] String optional

    Optional string to specify the table against which the field value is defined. Defaults to "sys_user".

  • [field] String optional

    Optional string to specify the category value being searched for with an active flag. Defaults to "u_owning user.

  • [field] String optional

    To handle the transition from "Category" to "Knowledge Base" where field names differ for the same class & meaning of property, this serves to indicate the field on the kb_knowledge_base table that should be pulled from the knowledge base when reached, if any. Defaults to "owner".

Returns:

GlideRecord:

Referencing the first active owner found or null if one could not be determined or none exists.

recurseCategoryOwner

(
  • category
  • [table]
  • [field]
  • [field]
)
GlideRecord private

Used by negotiateCategoryOwnership to perform the recursive lookup.

Parameters:

  • category GlideRecord

    The category to traverse looking for an active owner

  • [table] String optional

    Optional string to specify the table against which the field value is defined. Defaults to "sys_user".

  • [field] String optional

    Optional string to specify the category value being searched for with an active flag. Defaults to "u_owning user.

  • [field] String optional

    To handle the transition from "Category" to "Knowledge Base" where field names differ for the same class & meaning of property, this serves to indicate the field on the kb_knowledge_base table that should be pulled from the knowledge base when reached, if any. Defaults to "owner".

Returns:

GlideRecord:

The user record or null.

Properties

descriptionFields

Array

Ordered array indicating the order in which to try to set a field to indicate details for a record or task.

groupFields

Array

Ordered array indicating the order in which to try to set a field to indicate what group is assigned to a record or task

knowledge_base

GlideRecord

Reference to the knowledge base record being used.

summaryFields

Array

Ordered array indicating the order in which to try to set a field to indicate the summary or short description of a record or task.

userFields

Array

Ordered array indicating the order in which to try to set a field to indicate who should be considered the owner of a record.