---
sourceDocument: Xanadu API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# RemedialActionEngine - Scoped

# RemedialActionEngine - Scoped {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 6 minutes to read

The RemedialActionEngine API provides methods for working with remedial actions.  
This API is part of the Remedial Actions Framework and can be used to perform the following actions:

* Kick start a remedial action.
* Trigger the execution of a remedial action.
* Check the authorization of logged in user to execute the remedial action.
* Check the applicability of the remedial action against the target record.
* Get the current execution status and output payload of the targeted action.
{#RemedialActionScopedAPI__ul_mx3_dyr_gxb}

This API requires the Remedial Actions Framework (com.snc.sn_reacf) store application and is provided within the `sn_reacf` namespace.

## RemedialActionEngine - beginRemediation (String remedialAction, String parentTable, String parentRecord, Object actionParams, String targetRecord, String originRecord) {#ariaid-title2}

Starts any remedial action from the parent record against a target record. This method creates a new remedial action execution record in a 'Ready' state.
Note:  
When defining request parameters, remember that:

* If the parameter type is an object or array, define each property and its type.
* If the parameter type is GlideRecord, provide the associated table in your request.
{#RemAction-beginRemed_S_S_O_S_S__ul_v5r_54d_3yb}
{#RemAction-beginRemed_S_S_O_S_S__table_dcp_cgs_gxb__entry__3}

| Name | Type | Description |
|-|-|-|
| remedialAction | String or GlideRecord | Sys_id or internal_name or GlideRecord of the femedial action \[sn_reacf_remedial_action\] table. |
| parentTable | String | Table name of the parent record. |
| parentRecord | String | Sys_id of the parent record. |
| actionParams | Object | Optional. Map of remedial action parameter names and values. { "<parameter name>": <parameter value> } Note: Parameter value should be of type defined in remedial action Parameter \[sn_reacf_remedial_action_parameter\] table. |
| targetRecord | String or GlideRecord | Optional. Sys_id or GlideRecord of the configured Target table. |
| originRecord | String or GlideRecord | Optional. Sys_id or GlideRecord of the Remedial Action Origin \[sn_reacf_remedial_action_origin\] table. |
[Table 1. Parameters]

{#RemAction-beginRemed_S_S_O_S_S__table_dcp_cgs_gxb} {#RemAction-beginRemed_S_S_O_S_S__table_ecp_cgs_gxb__entry__2}

| Type | Description |
|-|-|
| Object | { "statusCode": "String", "actionExecutionRequestId": "String", "parentRecord": "String", "parentTable": "String" } |
| \<Object\>.statusCode | Status code of the remedial action execution request i.e. successful, duplicate_request or failed |
| \<Object\>.actionExecutionRequestId | Sys_id of the new Rremedial action execution record or duplicate concurrent Remedial Action Execution record |
| \<Object\>.parentRecord | Sys_id of the Parent record of the duplicate concurrent remedial action execution record. |
| \<Object\>.parentTable | Table name of the Parent record of the duplicate concurrent remedial action execution record. |
[Table 2. Returns]

{#RemAction-beginRemed_S_S_O_S_S__table_ecp_cgs_gxb}  
The following example shows how to start any remedial action. Here, the remedial action uses a CI Action internally to kill a process on a CI.

    var remedialAction = "9ef9924c436521101a24ff53e9b8f2d2" //sys_id of the Action
    var parentTable = "incident"; //table name of the Parent record
    var parentRecord = "62733787871e25105763ec6d0ebb3579" //sys_id of the Parent record
    var actionParams = {
        process_id: "322113"
    }
    var targetRecord = "af57a3418775e5105763ec6d0ebb356d"; //sys_id of the Target record
    var originRecord = "26e78022c3d525104f1a722e3f40dd99"; //sys_id of the Origin record

    var remedialActionEngine = new sn_reacf.RemedialActionEngine();
    var response = remedialActionEngine.beginRemediation(remedialAction, parentTable, parentRecord, actionParams, targetRecord, originRecord);
     
    gs.info(JSON.stringify(response));

Output object:

    Case 1 :successful : 
    {
      'statusCode': 'successful',
      'actionExecutionRequestId: '979b6060a5954300964fa3aa92874155'

    }

    Case 2 :Duplicate : 
    {
      'statusCode': 'duplicate_request,
      'actionExecutionRequestId': '552c48888c033300964f4932b03eb092',
      'parentRecord' : '1a14620f973be110539e35d11153afc8',
      'parentTable': 'incident'

    }

    Case 3 : Failed 
    {
      'statusCode': 'failed,
    }

## RemedialActionEngine - canCancel(String remedialActionExecution) {#ariaid-title3}

This method is used to check if the current user can or cannot cancel the given remedial action execution.
Note:  
When defining request parameters, remember that:

* If the parameter type is an object or array, define each property and its type.
* If the parameter type is GlideRecord, provide the associated table in your request.
{#RemAction-canCancel_S__ul_v5r_54d_3yb}
{#RemAction-canCancel_S__table_lkw_xrd_3yb__entry__3}

| Name | Type | Description |
|-|-|-|
| remedialActionExecution | String or GlideRecord | Sys_id or GlideRecord of the Remedial Action Execution \[sn_reacf_remedial_action_execution\] table. |
[Table 3. Parameters]

{#RemAction-canCancel_S__table_lkw_xrd_3yb} {#RemAction-canCancel_S__table_mkw_xrd_3yb__entry__2}

| Type | Description |
|-|-|
| Boolean | Flag that indicates whether the remedial action execution request can or cannot be canceled. Valid values: * true: The specified remedial action execution request can be canceled. * false: The specified remedial action execution request cannot be canceled. {#RemAction-canCancel_S__ul_wxm_psd_3yb} |
[Table 4. Returns]

{#RemAction-canCancel_S__table_mkw_xrd_3yb}  
The following example shows how to validate whether the current user can cancel any remedial action execution in its current state.

    var remedialActionExecutionId = "9ef9924c436521101a24ff53e9b8f2d2" //sys_id of sn_reacf_remedia_action_execution record

    var remedialActionEngine = new sn_reacf.RemedialActionEngine();
    var canCancel = remedialActionEngine.canCancel(remedialActionExecutionId)

    gs.info("canCancel: " + canCancel);

Output:

    canCancel: true

## RemedialActionEngine - cancelExecution(String remedialActionExecution) {#ariaid-title4}

Cancels a remedial action execution request, then updates the execution record to the state 'cancelled' and returns true upon success.
Note:  
When defining request parameters, remember that:

* If the parameter type is an object or array, define each property and its type.
* If the parameter type is GlideRecord, provide the associated table in your request.
{#RemAction-cancelExecution_S__ul_v5r_54d_3yb}
{#RemAction-cancelExecution_S__table_lkw_xrd_3yb__entry__3}

| Name | Type | Description |
|-|-|-|
| remedialActionExecution | String or GlideRecord | Sys_id or GlideRecord of the Remedial Action Execution \[sn_reacf_remedial_action_execution\] table. |
[Table 5. Parameters]

{#RemAction-cancelExecution_S__table_lkw_xrd_3yb} {#RemAction-cancelExecution_S__table_mkw_xrd_3yb__entry__2}

| Type | Description |
|-|-|
| Boolean | Flag that indicates whether the remedial action execution request can or cannot be canceled. Valid values: * true: The specified remedial action execution request is canceled successfully. A status of true updates the execution record to the state 'cancelled'. * false: The specified remedial action execution request is not canceled successfully. {#RemAction-cancelExecution_S__ul_wxm_psd_3yb} |
[Table 6. Returns]

{#RemAction-cancelExecution_S__table_mkw_xrd_3yb}  
The following example shows how to cancel any remedial action execution from its current state.

    var remedialActionExecutionId = "9ef9924c436521101a24ff53e9b8f2d2" //sys_id of sn_reacf_remedia_action_execution record

    var remedialActionEngine = new sn_reacf.RemedialActionEngine();
    var cancelExecution = remedialActionEngine.cancelExecution(remedialActionExecutionId)

    gs.info('cancelExecution: ' + cancelExecution);

Output:

    cancelExecution : true

## RemedialActionEngine - executeRemedialAction (String remedialActionExecution) {#ariaid-title5}

Triggers any remedial action execution that was started and is currently in Ready state. This method starts the targeted Action (e.g. CI Action) and moves the remedial action execution state to 'In Progress'.
{#RemAction-executeRemedialAction_S__table_htl_mfs_gxb__entry__3}

| Name | Type | Description |
|-|-|-|
| remedialActionExecution | String or GlideRecord | Sys_id or GlideRecord of the Remedial Action Execution \[sn_reacf_remedial_action_execution\] table. |
[Table 7. Parameters]

{#RemAction-executeRemedialAction_S__table_htl_mfs_gxb} {#RemAction-executeRemedialAction_S__table_itl_mfs_gxb__entry__2}

| Type | Description |
|-|-|
| Object | Object contains the action_execution_table and action_execution_id of the remedial action execution. { "action_execution_table": "String", "action_execution_id": "Sys_id" } |
[Table 8. Returns]

{#RemAction-executeRemedialAction_S__table_itl_mfs_gxb}  
The following example shows how to execute any remedial action.

    var remedialActionExecution = "8ed58be387d2a5100295ebd73cbb35a3"; //Sys_id of the Remedial Action Execution record 
     
    var remedialActionEngine = new sn_reacf.RemedialActionEngine(); 
    var response = remedialActionEngine.executeRemedialAction(remedialActionExecution); 
    gs.info("Response: " + JSON.stringify(response, null, 2));

Output:

    { 
      "action_execution_table": "sn_cimaf_action_request", 
      "action_execution_id": "2d7843a787d2a5100295ebd73cbb35d4" 
    }

## RemedialActionEngine - getRemedialActionOutput (String remedialActionExecution) {#ariaid-title6}

Gets the current execution status and output payload of the targeted Action.
{#RemAction-getRemedialActionOutput_S__table_rtg_32s_gxb__entry__3}

| Name | Type | Description |
|-|-|-|
| remedialActionExecution | String or GlideRecord | Sys_id or GlideRecord of the Remedial Action Execution \[sn_reacf_remedial_action_execution\] table. |
[Table 9. Parameters]

{#RemAction-getRemedialActionOutput_S__table_rtg_32s_gxb} {#RemAction-getRemedialActionOutput_S__table_stg_32s_gxb__entry__2}

| Type | Description |
|-|-|
| Object | Object contains the status object having value and display value of the target Action status, and payload array having the target Action outputs executed as part of the Remedial Action execution. Data type: String { "status": { "value": "completed", "displayValue": "Completed" }, "payload": [ "{\"output\":\"SUCCESS: The process with PID 19604 has been terminated.\\r\\n\",\"cmd\":\"taskkill /pid 19604 /f\"}" ] } |
[Table 10. Returns]

{#RemAction-getRemedialActionOutput_S__table_stg_32s_gxb}  
The following example shows how to get current execution status and output payload of the targeted Action.

    var remedialActionExecution = "8ed58be387d2a5100295ebd73cbb35a3"; //sys_id of the Remedial Action Execution record

    var remedialActionEngine = new sn_reacf.RemedialActionEngine();
    var response = remedialActionEngine.getRemedialActionOutput(remedialActionExecution);

    gs.info("Response: " + JSON.stringify(response, null, 2));

Output:

    {
      "status": {
        "value": "completed",
        "displayValue": "Completed"
      },
      "payload": [
        "{\"output\":\"SUCCESS: The process with PID 19604 has been terminated.\\r\\n\",\"cmd\":\"taskkill /pid 19604 /f\"}"
      ]
    }

## RemedialActionEngine - isApplicable (String remedialAction, String targetRecord) {#ariaid-title7}

Checks the applicability of any remedial action against a target record.
{#RemAction-isApplicable_S_S__table_m4x_wcs_gxb__entry__3}

| Name | Type | Description |
|-|-|-|
| remedialAction | String or GlideRecord | Sys_id or internal_name or GlideRecord of the remedial action \[sn_reacf_remedial_action\] table. |
| targetRecord | String or GlideRecord | Sys_id or GlideRecord of the configured Target table. |
[Table 11. Parameters]

{#RemAction-isApplicable_S_S__table_m4x_wcs_gxb} {#RemAction-isApplicable_S_S__table_n4x_wcs_gxb__entry__2}

| Type | Description |
|-|-|
| Boolean | Flag that indicates the target record's applicability for the remedial action. * true: the Remedial Action is applicable to the specified target record. * false: the Remedial Action is not applicable to the specified target record. {#RemAction-isApplicable_S_S__ul_tfw_lds_gxb} |
[Table 12. Returns]

{#RemAction-isApplicable_S_S__table_n4x_wcs_gxb}  
The following example shows how to check applicability of any remedial action against a target record.

    var remedialAction = "9ef9924c436521101a24ff53e9b8f2d2"; //Sys_id of the Remedial Action Execution record 
    var targetRecord = "df3799a387a921100295ebd73cbb35c4"; //Sys_id of the Target Record 
     
    var remedialActionEngine = new sn_reacf.RemedialActionEngine(); 
    var isApplicable = remedialActionEngine.isApplicable(remedialAction, targetRecord); 
    gs.info("Is applicable: " + isApplicable);

Output:

    Is applicable: true

## RemedialActionEngine - isAuthorized(String remedialAction) {#ariaid-title8}

Checks if the user is authorized to execute the remedial action.
{#RemAction-isAuthorized_S__table_wpy_jzr_gxb__entry__3}

| Name | Type | Description |
|-|-|-|
| remedialAction | String or GlideRecord | Sys_id or internal_name or GlideRecord of the Remedial Action \[sn_reacf_remedial_action\] table. |
[Table 13. Parameters]

{#RemAction-isAuthorized_S__table_wpy_jzr_gxb} {#RemAction-isAuthorized_S__table_xpy_jzr_gxb__entry__2}

| Type | Description |
|-|-|
| Boolean | Flag that indicates the resulting success status of the user's authorization. * true: The user's authorization is successful. * false: The user's authorization is unsuccessful. {#RemAction-isAuthorized_S__ul_wzf_lbs_gxb} |
[Table 14. Returns]

{#RemAction-isAuthorized_S__table_xpy_jzr_gxb}  
The following example shows how to check authorization to execute any remedial action.

    var actionSysId = "e62f550843e121101a24ff53e9b8f23b"; //Sys_id of the Action 
     
    var remedialActionEngine = new sn_reacf.RemedialActionEngine(); 
    var isAuthorized = remedialActionEngine.isAuthorized(actionSysId); 
    gs.info("Is user authorized: " + isAuthorized);

Output:

    Is user authorized: true


