A business entity service consists of multiple service phases. You can configure a service phase to invoke an external call and trigger a supported event.
Service phases trigger in the following order:
BeforeEverything. Invokes an external call and triggers a supported event before performing the logic of the service, such as validation, localization, and projection. A sample use case might involve you configuring this service phase to change the default merge behavior to prevent a merge of an attribute of two business entities. For example, during a merge of two or more Person records, you can prevent the merge of the child telephone number records of a parent Person record.
Projection is the process of adding cross reference information to specific business entity service responses. You can consider projection as a possible additional step that occurs before or after a particular service phase.
BeforeValidate. Invokes an external call and triggers a supported event before validating the input data. A sample use case might involve you configuring this service phase to validate logic before validating the input data when persisting a business entity. For example, address or phone number validation that occurs against an external third-party service before persisting a Person record.
AfterValidate. Invokes an external call and triggers a supported event immediately after validating the input data. A sample use case might involve you configuring this service phase to validate logic after validating the input data when persisting a business entity. For example, address or phone number validation that occurs against an external third-party service after persisting a Person record.
When the AfterValidate service triggers, the input data might be different because the previous service phase modified or processed the data.
AfterEverything. Invokes an external call and triggers a supported event after performing the logic of the service, such as validation, localization, and projection. A sample use case might involve you configuring this service phase to trigger notification after the service performs all the logic. For example, sending an email notification after a successful merge of two or more Person records.
When the AfterEverything service phase triggers, an external call has access to the data from the service response and not the input data.
Services that Support Service Phases
You can use the following internal services that support service phases:
WriteCO
Persists and updates business entities. The WriteCO service supports the following service phases:
BeforeEverything
BeforeValidate
AfterValidate
AfterEverything
These service phases trigger before, during, and after a business entity persists.
WriteView
Persists and updates business entity views. The WriteView service supports the following service phases:
BeforeEverything
BeforeValidate
AfterValidate
AfterEverything
These service phases trigger before, during, and after a business entity persists.
The WriteView service triggers all supported WriteCO service phases in the following order:
WriteView.BeforeEverything
WriteView.BeforeValidate
WriteView.AfterValidate
WriteCO.BeforeEverything
WriteCO.BeforeValidate
WriteCO.AfterValidate
WriteCO.AfterEverything
WriteView.AfterEverything
ReadCO
Retrieves business entities. The ReadCO service supports the following service phases:
BeforeEverything
AfterEverything
These service phases trigger before and after a read of a business entity.
ReadView
Retrieves business entity views. The ReadView service supports the following service phases:
BeforeEverything
AfterEverything
These service phases trigger before and after a read of a business entity view.
The ReadView service triggers all supported ReadCO service phases in the following order:
ReadView.BeforeEverything
ReadCO.BeforeEverything
ReadCO.AfterEverything
ReadView.AfterEverything
PreviewMergeCO
Retrieves the merge preview result of multiple business entities. The PreviewMergeCO service supports the following service phases:
BeforeEverything
AfterEverything
These service phases trigger before and after the generation of the preview of a merged business entity.
MergeCO
Merges multiple business entities. The MergeCO service supports the following service phases:
BeforeEverything
AfterEverything
These service phases trigger before and after the merge of a business entity.