Trigger Domain Services

The generated SDK provides functions to easily trigger domain services from other places in the service.

Input and output entity

When triggering a domain service, it might be necessary to provide an input entity. The Entity factory can be used to create new input entities, which could be set as input parameter for the service.

If there is an output defined for the domain service, it is returned as a result and can be used for further processing.

Trigger domain service

The following code shows how to trigger a domain service, for example from another service implementation.

// Initialize service input via factory and assign value to input properties
const input = this.factory.entity.nsacrnm.ServiceIdentifier_Input();
input.property1 = 'Some property value';

// Trigger a domain service 
const output = await this.services.nsacrnm.ServiceIdentifier(input);

// Access service output
const val = output.propIdentifier;