Configuring campaign elements for working with triggers
Glossary Item Box
Introduction
Starting from version 7.12.4, a new [Triggered adding] campaign element has been added to bpm'online. 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.
Case description
Configure the marketing campaign element for sending SMS messages to users. Learn how to create this element in the “Adding a custom campaign element” article.
Case implementation algorithm
1. Modifying the class that interacts with the server side of the application
ATTENTION
Perform steps 1-6 from the “Adding 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 ElementType — CampaignSchemaElementType.Sessioned in the class constructor.
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.
// 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); }