Data change requests (DCR)
The data change request (DCR) framework enables users to monitor and track changes on any object in Komodo Care Connect. It is especially useful when there are data in Komodo Care Connect relevant to external systems because you can ensure that the data and integrations with Komodo Care Connect remain in sync. It is also helpful for you to maintain an audit trail on objects based on certain criteria. The Data Change Request (mvn__PJN_Data_Change_Request__c
) object acts as a header for a group of changes to a record while the Data Change Request Line (mvn__PJN_Data_Change_Request_Line__c
) object stores the specific data changes that occur on a single field. The DCR framework can be enabled or disabled with the Data Change Request Handler (mvn.PJN_DataChangeRequestHdlr
), an implementation of the Trigger Dispatcher Handler Interface (PJN_TriggerDispatcher.HandlerInterface
) that is provided out of the box.
Note
To use the DCR framework in Komodo Care Connect V2 and above, users must be assigned the KCC - Feature - Data Change Request (PJN_Data_Change_Request
) permission set.
To use the DCR framework in Komodo Care Connect V1, users must be assigned the KCC - Data Change Request (PJN_Data_Change_Request
) permission set.
Setup and configuration
To set up and configure the DCR framework for a specific object:
Ensure that the object has been enabled for the Trigger Dispatcher. If not, create a new trigger accordingly.
Create a new Trigger Handler Setting (
mvn__PJN_Trigger_Handler_Setting__mdt
) metadata record.Set the Class field to
mvn.PJN_DataChangeRequestHdlr
.Set the Event field to one of the following:
Insert
to capture inserts of records that match the criteria. Only the new value will be captured on the data change request line.Update
to capture updates of records that match the criteria. Both the old value and the new value will be captured on the data change request line.Delete
to capture deletions of records that match the criteria. Only the old value will be captured on the data change request line.
Create a new Data Change Request Criteria (
mvn__PJN_Data_Change_Request_Criteria__mdt
) metadata record to define the criteria that would trigger the DCR framework to run. For information on how to set the Criteria JSON (mvn__PJN_Criteria_JSON__c
) field, reference the Criteria definition page.Table 118. Sample mvn__PJN_Criteria_JSON__c valuesCriteria type
Description
Sample JSON string
Simple criteria
Tracks changes on a physician account.
{ "path":"mvn__PJN_Record_Type_Developer_Name__c", "operator":"Equals", "value":"PJN_Physician" }
Compound criteria
Tracks changes on either a physician or a staff account.
{ "AnyTrue": [ { "path":"mvn__PJN_Record_Type_Developer_Name__c", "operator":"Equals", "value":"PJN_Physician" }, { "path":"mvn__PJN_Record_Type_Developer_Name__c", "operator":"Equals", "value":"PJN_Staff" } ] }
Create a new Data Change Request Field (
mvn__PJN_Data_Change_Request_Field__mdt
) metadata record to define the fields that should be monitored in the DCR framework.
Mock DCR configuration for testing
To mock the configuration of the DCR framework in unit tests, use the following global Apex classes to mock the DCR metadata:
Data Change Request Criteria Selector (
PJN_DataChangeRequestCriteriaSelector
), which is a selector for the Data Change Request Criteria (mvn__PJN_Data_Change_Request_Criteria__mdt
) custom metadata type.Data Change Request Field Selector (
PJN_DataChangeRequestFieldSelector
), which is a selector for the Data Change Request Field (mvn__PJN_Data_Change_Request_Field__mdt
) custom metadata type.