Skip to main content
Version: 8.0

Configure campaign elements for working with triggers

Level: advanced

Starting from version 7.12.4, a new Triggered adding campaign element has been added to Creatio. The way the element works with campaign audience has been changed: as soon as the trigger is run, the synchronous campaign element is launched.

Thus, new and existing campaign elements must be configured for working with this element.

To include the custom element into the synchronous fragment and make sure it works correctly both for the scheduled execution and triggers, make the following changes on the server side:

  • Specify the additional CampaignSchemaElementType.Sessioned type for the element.
  • The executed element for the campaign custom element (the inheritor of the CampaignProcessFlowElement class) must work using the CampaignAudience base property. Perform all operations (specifying the audience, selecting the Step complete checkbox) via the object in the CampaignAudience property of the ICampaignAudience type.
Example

Configure the marketing campaign element for sending SMS messages to users. Learn how to create this element in the "Add a custom campaign element" article.

Example implementation algorithm

1. Modifying the class that interacts with the server side of the application

Important

Perform steps 1-6 from the "Add a custom campaign element" article before you implement the case.

Change the TestSmsElement source code schema class (the inheritor of the CampaignSchemaElement class). Specify additional ElementTypeCampaignSchemaElementType.Sessioned in the class constructor.

TestSmsElement
public TestSmsElement() {
// TestSmsElement is asynchronous and session element that can be triggered.
ElementType = CampaignSchemaElementType.AsyncTask | CampaignSchemaElementType.Sessioned;
}

2. Modifying the executed element for the new campaign element

Modify the TestSmsCampaignProcessElement source code schema class (the inheritor of the CampaignProcessFlowElement class). Add the audience reading operation to the SafeExecute() method implementation via the object in the CampaignAudience property of the ICampaignAudience type.

TestSmsCampaignProcessElement
// Method implementation of the element performance.
protected override int SafeExecute(ProcessExecutingContext context) {
// TODO: Implement sending SMS-messages.
//
//
// Receive the audience that is available for processing by the element at the moment..
var audienceSelect = CampaignAudience.GetItemAudienceSelect(CampaignItemId);
//
// Specify the current audience step as [Complete].
return CampaignAudience.SetItemCompleted(SchemaElementUId);
}