How Do I Implement Default Behaviour for a Domain Response?
When using a domain function or external domain request/response in a flow, you need to:
-
Define a set of events that represent the possible outcomes of the domain response
-
Specify the input behaviour that maps the domain response to one of these events.
While this is straightforward to implement, it can become repetitive and boilerplate-heavy when the domain response is handled the same way across multiple flow definitions.
To overcome this potential redundancy, you can use the provided "default behaviour" functionality on a domain response definition. This feature allows you to specify events and input behaviour at the response level, removing the need to define this information separately for each flow definition. Note the word "default" here — any flow definition can override this default behaviour for a specific response when required.
Implementing Default Behaviour for a Domain Response
Implementing default behaviour for a domain response is simple. In the response section of the domain function or external domain request/response definition, open the inspector (CTRL+ALT+I) and provide the required information just as you would for the input behaviour on a flow definition:
Note that domain response default behaviour implementations can only use events that are defined in an event library.