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.
Procedure
Access Execution History in Family Policies
Procedure
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.
Field ID | Data Type | Description |
---|---|---|
MI_POLICY_EXEC_LOG.PLOG_KEY | String | Unique key of the execution history log record |
MI_POLICY_EXEC_LOG.PLOG_KEY | String | Unique key of the execution history log record. |
MI_POLICY_EXEC_LOG.POLICY_KEY | String | Entity Key of the related policy. Empty for family policy execution records. |
MI_POLICY_EXEC_LOG.INST_KEY | String | Entity Key of the related policy instance. Empty for family policy execution records. |
MI_POLICY_EXEC_LOG.PLOG_START_TM | Date and Time | Start of execution. |
MI_POLICY_EXEC_LOG.PLOG_TRIG_TM | Date and Time | Start of processing by the policy trigger service. Empty for family policy execution records. |
MI_POLICY_EXEC_LOG.PLOG_END_TM | Date and Time | End of execution. |
MI_POLICY_EXEC_LOG.PLOG_ACTION_TAKEN_FLG | Boolean | True if an action node was executed. |
MI_POLICY_EXEC_LOG.PLOG_ERRORS_FLG | Boolean | True if an error occurred. |
MI_POLICY_EXEC_LOG.PLOG_WARNINGS_FLG | Boolean | True if a warning occurred. |
MI_POLICY_EXEC_LOG.PLOG_SUMMARY_MEM | Text | Summary of the policy execution results. Displayed in the Execution History tab in Policy Designer or Family Policy. |
MI_POLICY_EXEC_LOG.PLOG_REV_NBR | Integer | Revision 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_TX | Text | Detailed policy execution results in JSON format. |
MI_POLICY_EXEC_LOG.FAMPOLICY_KEY | String | Entity key of the related family policy. Empty for Policy Designer execution records. |
MI_POLICY_EXEC_LOG.TRIGGERED_BY_CHR | String | Information 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%')