Policy Execution

About Family Policy Execution

When records in the APM database are created, modified, or deleted, any family policies configured for the corresponding family and trigger will be executed automatically. For example, if an After Insert family policy is configured for the Reading family, the policy will be executed after a Reading record is added to the database.

When a policy is executed, the logic in the policy model is evaluated and any resulting actions are taken. Each time a family policy is executed, the results of the execution are recorded in the execution log, which you can view on the Execution History pane in the Policy Design page.

A change to a record in the APM database will trigger the appropriate family policy regardless of the current user's permissions. However, if the user does not have permissions for an action a policy is taking, the policy will not execute, the transaction will be rolled back, and no changes will be made. Similarly, the transaction will be rolled back if an error occurs during policy execution.

Configure Family Policy Execution History Log Setting

About This Task

You can configure the policy to determine when execution history log records will be created.

Important: The Family Policy execution history records can significantly impact the size of the APM database. To minimize the impact, you can select either the Errors Only or Summary Only option.

Procedure

  1. Access the Family Policy for which you want to configure the execution history log setting.
  2. In the Details workspace, in the Execution History Log Setting section, select one of the following options.
    OptionDescription
    NormalCreates an execution history record for every execution of the policy. This option is selected by default for new policies.
    Errors OnlyCreates an execution history record only for the executions of the policy that result in an error. This option can be used to reduce the number of execution history records being added to the APM database, thus reducing the load on the database server.
    Note:

    If you select the Errors Only option, you can only review the execution results in the design canvas for policy executions that result in errors.

    This setting does not affect the policy execution server log files.

    Summary OnlyCreates an execution history record for every execution of the policy and saves only the summary of the execution in the record. You can use this option to reduce the file size of the execution history records being added to the APM database.
    Note: If you select Summary Only in the Execution History Log Setting section and the policy execution resulted in an error, the node execution details are also saved along with the summary.
    For policies which include Sub Policy nodes, execution history logs are created as follows:
    • If the Execution History Log Setting is Normal for a calling policy, and Errors Only for the sub policy, an execution history record is created for every execution of the calling policy. The Sub Policy node in the execution history records displays execution details only for the executions of the sub policy, which resulted in an error.
    • If the Execution History Log Setting is Errors Only for a calling policy, and Normal for the sub policy, an execution history record is created only for the executions of the calling policy, which resulted in an error. The Sub Policy node In the execution history records displays the execution details for every execution of the sub policy, regardless of whether the sub policy execution resulted in an error.
    • If the Execution History Log Setting is Errors Only for both calling policy and sub policy, an execution history record is created only for the executions of the calling policy, which resulted in an error. The Sub Policy node in the execution history record displays execution details only for the executions of the sub policy, which resulted in an error.
    • If the Execution History Log Setting is Summary Only for a calling policy, and Errors Only for the sub policy, an execution history record that contains the summary of the execution is created for every execution of the calling policy. The Sub Policy node in the execution history records displays the node execution details also when the sub policy execution resulted in an error.
  3. On the toolbar, select

    The policy is saved. The execution history log setting is applied to subsequent policy executions.

Access Execution History in Family Policies

Procedure

  1. Access the policy for which you want to view the execution history.
  2. In the Design workspace, select the Execution History tab.

    The Execution History pane appears, displaying a summary of past executions.

  3. Select an execution summary to view additional details on the policy canvas.

    On the policy canvas, the nodes in the model are color-coded to indicate the results of the execution.

    Note:
    • If changes have been made to the policy model since the selected execution occurred, you will not be able to view the details of that execution on the canvas.
    • You can use the Actions and Errors and Warnings check boxes to display only the executions that resulted in actions or only the executions that resulted in errors and warnings.
    • Execution history records are retained for the duration specified in the Policy Admin page.
  4. In the policy model, select a node to view additional details about the specific node's execution.
  5. To filter the summary of the execution results, select , and then enter the search criteria.
    Note:
    • The button is enabled only if there are at least two search results.
    • The filter is reset if you place the cursor outside the result grid.
  6. To export the summary of execution results, on the right side of the pane, select Export data.
    The summary is exported into an Excel spreadsheet. If you have applied a filter, only the filtered data is exported.
    Note: To avoid performance issues, we recommend that you export less than 10,000 rows.

About Execution History Logs

Execution history logs are stored in a non-family table, MI_POLICY_EXEC_LOG, in the APM database. You can access these records using a query by typing the code directly into the SQL tab of the query designer. This table contains logs for both Policy Designer and Family Policy executions.

Execution History Log Fields

The following table describes the fields in the MI_POLICY_EXEC_LOG table.

Table 1.
Field IDData TypeDescription
MI_POLICY_EXEC_LOG.PLOG_KEYStringUnique key of the execution history log record
MI_POLICY_EXEC_LOG.PLOG_KEYStringUnique key of the execution history log record.
MI_POLICY_EXEC_LOG.POLICY_KEYStringEntity Key of the related policy. Empty for family policy execution records.
MI_POLICY_EXEC_LOG.INST_KEYStringEntity Key of the related policy instance. Empty for family policy execution records.
MI_POLICY_EXEC_LOG.PLOG_START_TMDate and TimeStart of execution.
MI_POLICY_EXEC_LOG.PLOG_TRIG_TMDate and TimeStart of processing by the policy trigger service. Empty for family policy execution records.
MI_POLICY_EXEC_LOG.PLOG_END_TMDate and TimeEnd of execution.
MI_POLICY_EXEC_LOG.PLOG_ACTION_TAKEN_FLGBooleanTrue if an action node was executed.
MI_POLICY_EXEC_LOG.PLOG_ERRORS_FLGBooleanTrue if an error occurred.
MI_POLICY_EXEC_LOG.PLOG_WARNINGS_FLGBooleanTrue if a warning occurred.
MI_POLICY_EXEC_LOG.PLOG_SUMMARY_MEMTextSummary of the policy execution results. Displayed in the Execution History tab in Policy Designer or Family Policy.
MI_POLICY_EXEC_LOG.PLOG_REV_NBRIntegerRevision number of the policy model when the policy was executed. If this value is equal to the current policy model revision, the execution history details can be displayed in the design canvas.
MI_POLICY_EXEC_LOG.PLOG_DATA_TXTextDetailed policy execution results in JSON format.
MI_POLICY_EXEC_LOG.FAMPOLICY_KEYStringEntity key of the related family policy. Empty for Policy Designer execution records.
MI_POLICY_EXEC_LOG.TRIGGERED_BY_CHRStringInformation about how the policy execution was triggered.

Example Execution History Log Query

The query shown below retrieves policy designer execution history log records where an Add Value to Health Indicator node was executed, with execution start time between March 1 and March 31, 2023:

SELECT [MI_POLICY].[MI_POLICY_ID_C] "Policy Name"
, MI_POLICY_EXEC_LOG.POLICY_KEY "Policy Key"
, MI_POLICY_EXEC_LOG.PLOG_START_TM "Start Time"
, MI_POLICY_EXEC_LOG.PLOG_SUMMARY_MEM "Summary"
FROM MI_POLICY_EXEC_LOG 
 JOIN [MI_POLICY] ON MI_POLICY_EXEC_LOG.POLICY_KEY = [MI_POLICY].ENTY_KEY
WHERE (MI_POLICY_EXEC_LOG.PLOG_START_TM >= '2023-03-01' AND MI_POLICY_EXEC_LOG.PLOG_START_TM < '2020-04-01' AND MI_POLICY_EXEC_LOG.PLOG_SUMMARY_MEM LIKE '%Add Value to HI%')