The Marketing Automation application services

Current version: 9.2

The Marketing Automation application provides a set of services through dependency injection but does not offer support for constructor injection. Therefore the activity editor can only access the services through the context injector. The Marketing Automation application services are useful when creating campaign activity editors.

The alert service

The alert service shows the Success, Info, Warning, and Error alerts.

The following command imports the service type and the injection token:

RequestResponse
import { ALERT_SERVICE, IAlertService } from '@sitecore/ma-core';

The following command creates an instance of IAlertService:

RequestResponse
constructor(private injector: Injector) {
  super();
  let alertService: IAlertService = injector.get(ALERT_SERVICE);
}

The translate service

The translate service provides the access to the dictionary items located in the Core database under the /sitecore/client/Applications/MarketingAutomation/Translations item.

The following command imports the service type and the injection token:

RequestResponse
import { TRANSLATE_SERVICE } from '@sitecore/ma-core';
import { TranslateService } from '@ngx-translate/core';

The following command creates an instance of TranslateService:

RequestResponse
constructor(private injector: Injector) {
  super();
  let translateService: TranslateService = injector.get(TRANSLATE_SERVICE);
}

The activity data service

The activity data service provides access to the activity descriptor and classification information. This information is a representation of the activity item located in the Master database under the /sitecore/system/Settings/Analytics/Marketing Automation/Activity Types item.

The following command imports the service type and the injection token:

RequestResponse
import { ACTIVITY_DATA_SERVICE, IActivityDataService } from '@sitecore/ma-core';

The following command creates an instance of IActivityDataService:

RequestResponse
constructor(private injector: Injector) {
  super();
  let activityDataService: IActivityDataService = injector.get(ACTIVITY_DATA_SERVICE);
}

The server connection service

The server connection service is a wrapper for the HTTP service that comes with Angular. It provides error handling for failed requests and caching for responses.

The following command imports the service type and the injection token:

RequestResponse
import { SERVER_CONNECTION_SERVICE, IServerConnectionService } from '@sitecore/ma-core';

The following command creates an instance of IServerConnectionService:

RequestResponse
constructor(private injector: Injector) {
  super();
  let serverConnectionService: IServerConnectionService = injector.get(SERVER_CONNECTION_SERVICE);
}

Do you have some feedback for us?

If you have suggestions for improving this article,