CSBScratchpadUtil - Scoped
-
- UpdatedFeb 1, 2024
- 4 minutes to read
- Washington DC
- API reference
The CSBScratchpadUtil API allows consumers to share "extra" information that is outside of any other Service Bridge service, with their providers.
This information is stored as name-value pairs in the Scratchpad [sn_sb_scratchpad] table. The shared information must be associated with tasks that are of one of two types: provider tasks or remote tasks.
If the associated task is active, the updated scratchpad information syncs to the consumer instance. If a task is deactivated or deleted, the information in the scratchpad is also deleted after a specified number of days; by default three. This default is defined in the sn_sb.scratchpad.autodelete.days property.
Both providers and consumers can add, update, and remove information to and from the Scratchpad table. Producers update this information using the PSBScratchpadUtil API.
To access this API, the Service Bridge for Consumers application must be installed. This API runs in the sn_sb_con
namespace.
CSBScratchpadUtil - get(GlideRecord taskGR, String name)
Returns the value of a specified scratchpad property.
Name | Type | Description |
---|---|---|
taskGR | GlideRecord | GlideRecord of the active remote task or provider task associated with the specified scratchpad property. These records are located in the Remote task [sn_sb_con_remote_task] and Provider task [sn_sb_con_provider_task] tables. |
name | String | Name of the scratchpad property whose value to retrieve. Located in the Scratchpad [sn_sb_scratchpad] table. |
Type | Description |
---|---|
String or null | Value of the requested scratchpad property. Null if the property isn't found. |
Example
The following code example shows how to call this method.
Output:
CSBScratchpadUtil - getAll(GlideRecord taskGR)
Returns the property names and values (name-value pairs) of all scratchpad properties associated with the specified task.
Name | Type | Description |
---|---|---|
taskGR | GlideRecord | GlideRecord of the active remote task or provider task whose associated scratchpad properties to return. These records are located in the Remote task [sn_sb_con_remote_task] and Provider task [sn_sb_con_provider_task] tables. |
Type | Description |
---|---|
Object | All property names and values contained in the specified task. In the form:
|
Example
The following code example shows how to call this method.
Output:
CSBScratchpadUtil - getNames(GlideRecord taskGR)
Returns the list of names of all scratchpad properties associated with the specified task record.
Name | Type | Description |
---|---|---|
taskGR | GlideRecord | GlideRecord of the active remote task or provider task for which to return the list of names of all associated scratchpad properties. These records are located in the Remote task [sn_sb_con_remote_task] and Provider task [sn_sb_con_provider_task] tables. |
Type | Description |
---|---|
String Array | List of names of the scratchpad properties associated with the specified task record. |
Example
The following code example shows how to call this method.
Output:
CSBScratchpadUtil - populateClientScratchpadBR(GlideRecord taskGR)
Places the scratchpad properties associated with the specified remote task or provider task in the client g_scratchpad.
You can call this method from a UI display business rule.
Name | Type | Description |
---|---|---|
taskGR | GlideRecord | GlideRecord of the active remote task or provider task whose associated scratchpad entries should be placed in the client g_scratchpad. These records are located in the Remote task [sn_sb_con_remote_task] and Provider task [sn_sb_con_provider_task] tables. |
Type | Description |
---|---|
None |
Example
The following code example shows how to call this method.
CSBScratchpadUtil - remove(GlideRecord taskGR, String name)
Deletes the specified scratchpad property from the Scratchpad [sn_sb_scratchpad] table.
Name | Type | Description |
---|---|---|
taskGR | GlideRecord | GlideRecord of the active remote task or provider task associated with the specified scratchpad property. These records are located in the Remote task [sn_sb_con_remote_task] and Provider task [sn_sb_con_provider_task] tables. |
name | String | Name of the scratchpad property to remove from the Scratchpad [sn_sb_scratchpad] table. |
Type | Description |
---|---|
None |
Example
The following code example shows how to call this method.
Output:
CSBScratchpadUtil - update(GlideRecord taskGR, String name, String value, Boolean client_side_accessible)
Inserts a property or updates the value of a property in the Scratchpad [sn_sb_scratchpad] table.
Type | Description |
---|---|
None |
Example
The following code example shows how to call this method.
Output:
On this page
- CSBScratchpadUtil - get(GlideRecord taskGR, String name)
- CSBScratchpadUtil - getAll(GlideRecord taskGR)
- CSBScratchpadUtil - getNames(GlideRecord taskGR)
- CSBScratchpadUtil - populateClientScratchpadBR(GlideRecord taskGR)
- CSBScratchpadUtil - remove(GlideRecord taskGR, String name)
- CSBScratchpadUtil - update(GlideRecord taskGR, String name, String value, Boolean client_side_accessible)