The Marketing Automation application services

Abstract

Overview of the Sitecore Marketing Automation application services that are used when creating campaign activity editors.

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:

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

The following command creates an instance of IAlertService:

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:

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

The following command creates an instance of TranslateService:

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:

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

The following command creates an instance of IActivityDataService:

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:

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

The following command creates an instance of IServerConnectionService:

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