StateManagementScriptableApi - Global
-
- UpdatedJan 30, 2025
- 5 minutes to read
- Yokohama
- API reference
The StateManagementScriptableApi provides a set of methods for manipulating configuration item (CI) operational states and applying CI actions.
The StateManagementScriptableApi methods adhere to restrictions and allowances specified by not allowed CI actions, compatible CI actions, and not allowed operational transitions. If a method attempts to perform a restricted operation, the operation is blocked, an error is logged, and a task is created if appropriate.
The StateManagementScriptableApi methods are static methods. You access the methods using the SNC.StateManagementScriptableApi
global object.
StateManagementScriptableApi - addBulkCIAction(String requestorId, String sysIdList, String ciActionName, String ciActionListOld, String leaseTime)
Add a CI action to a list of CIs.
Type | Description |
---|---|
String | A JSON formatted string with name-value pairs for
|
StateManagementScriptableApi - extendCIActionLease( String requestorId, String ciSysId, String ciActionName, String leaseTime)
Extend the CI-action-lease time for the registered user. If the previous lease has expired, the new lease time starts now.
Type | Description |
---|---|
String | A JSON formatted string with name-value pairs for
|
StateManagementScriptableApi - getCIActions(String ciSysId)
Returns a list of active CI actions for the specified CI.
Name | Type | Description |
---|---|---|
ciSysId | String | Sys_id of the CI. |
Type | Description |
---|---|
String | A JSON formatted string with name-value pairs. Possible values:
|
Example
The following example shows how to get active actions for a list of configuration items.
Output:
StateManagementScriptableApi - getOperationalState(String ciSysId)
Returns the operational state of the CI.
Name | Type | Description |
---|---|---|
ciSysId | String | Sys_id of the CI. |
Type | Description |
---|---|
String | A JSON formatted string with name-value pairs. Possible values:
|
Example
The following example shows how to get the operational states of a list of specified configuration items.
Output:
StateManagementScriptableApi - isCompatibleCIAction(String actionName, String otherActionName)
Determines if the two specified actions are compatible.
Name | Type | Description |
---|---|---|
actionName | String | A CI action name |
otherActionName | String | A CI action name |
Type | Description |
---|---|
Boolean | Returns true if the two specified CI actions are compatible. |
StateManagementScriptableApi - isLeaseExpired(String requestorId, String ciSysId, String ciActionName)
Determines if the lease has expired for the requestor of a specified CI Action.
Name | Type | Description |
---|---|---|
requestorId | String | A sys_id of a workflow context, or the GUID returned from the registerOperator() method. |
ciSysId | String | The CI's sys_id. |
ciActionName | String | Name of the CI action. |
Type | Description |
---|---|
String | A JSON formatted string with name-value pairs for
|
StateManagementScriptableApi - isNotAllowedAction(String ciType, String opsLabel, String actionName)
For a type of CI, determine if a CI action is not allowed for an operational state.
Name | Type | Description |
---|---|---|
ciType | String | The CI type |
opsLabel | String | The operational state |
actionName | String | The CI action name |
Type | Description |
---|---|
Boolean | Returns true if the action is not allowed on the specified CI type in the specified operational state. |
StateManagementScriptableApi - isNotAllowedOpsTransition(String ciType, String opsLabel, String transitionOpsLabel)
For a type of CI, determine if an operational state transition is not allowed.
Name | Type | Description |
---|---|---|
ciType | String | The CI type |
opsLabel | String | The label of the beginning operational state. |
transitionOpsLabel | String | The label of the ending operational state. |
Type | Description |
---|---|
Boolean | Returns true if specified operational state transition is not allowed on the specified CI type. |
StateManagementScriptableApi - isValidRequestor(String requestorId)
Determines if the specified requestor is a valid active workflow user or a registered user.
Name | Type | Description |
---|---|---|
requestorId | String | Sys_id of a workflow context or the GUID returned from the registerOperator() method. |
Type | Description |
---|---|
String | JSON formatted name-value pairs. Possible values:
|
Example
This example show how to use the isValidRequestor() method to check if an operator is a registered user.
Output:
StateManagementScriptableApi - registerOperator()
Registers an operator for a non-workflow user.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
String | A JSON formatted string with name-value pairs for
|
Example
StateManagementScriptableApi - removeBulkCIAction(String requestorId, String sysIdList, String ciActionName)
Removes a CI action for a list of CIs.
Name | Type | Description |
---|---|---|
requestorId | String | A sys_id of a workflow context, or the GUID returned from the registerOperator() method. |
sysIdList | String | A comma separated list of CI sys_ids |
ciActionName | String | The CI action name |
Type | Description |
---|---|
String | A JSON formatted string with name-value pairs for
|
StateManagementScriptableApi - setBulkCIOperationalState(String requestorId, String sysIdList, String opsLabel, String opsStateListOld)
Set the operational state for list of CIs.
Type | Description |
---|---|
String | A JSON formatted string with name-value pairs for
|
Example
StateManagementScriptableApi - unregisterOperator( String requestorId)
Unregisters an operator for non-workflow users.
Name | Type | Description |
---|---|---|
requestorId | String | Sys_id of a workflow context or the GUID returned from the registerOperator() method. |
Type | Description |
---|---|
String | JSON formatted name-value pairs. Possible values:
|
Example
This example show how to use the unregisterOperator() method to unregister a registered user.
Output:
On this page
- StateManagementScriptableApi - addBulkCIAction(String requestorId, String sysIdList, String
ciActionName, String ciActionListOld, String leaseTime)
- StateManagementScriptableApi - extendCIActionLease( String requestorId, String ciSysId,
String ciActionName, String leaseTime)
- StateManagementScriptableApi - getCIActions(String ciSysId)
- StateManagementScriptableApi - getOperationalState(String ciSysId)
- StateManagementScriptableApi - isCompatibleCIAction(String actionName, String
otherActionName)
- StateManagementScriptableApi - isLeaseExpired(String requestorId, String ciSysId, String
ciActionName)
- StateManagementScriptableApi - isNotAllowedAction(String ciType, String opsLabel, String
actionName)
- StateManagementScriptableApi - isNotAllowedOpsTransition(String ciType, String opsLabel,
String transitionOpsLabel)
- StateManagementScriptableApi - isValidRequestor(String requestorId)
- StateManagementScriptableApi - registerOperator()
- StateManagementScriptableApi - removeBulkCIAction(String requestorId, String sysIdList,
String ciActionName)
- StateManagementScriptableApi - setBulkCIOperationalState(String requestorId, String
sysIdList, String opsLabel, String opsStateListOld)
- StateManagementScriptableApi - unregisterOperator( String requestorId)