Skip to main content
To create a workflow for user actions where performing a certain event grants consent for subscribing users to specific marketing campaigns, such as email subscriptions, you can use custom transformation with directives as explained below. Here, the challenge is that the consent enricher enforces the value to be either “yes” or “no”. If the user does not buy a product in any other event, it will change the consent to “no” for the same user. Instead, use this custom transformer with the directives mentioned in the use case below to keep the consent as “null” and make it “yes” only when the customer performs the “place order” event.

Use Case: Automating Email Subscription for Customers Placing Orders

Let’s say, you want to subscribe customers who place orders on your portal to your email campaigns. To do so, you need to set up a workflow that defines the consent for Email Subscription as “Yes” when a customer performs a Place order event from their streaming source. In order to achieve this, in the mapping screen, create a custom consent field for Email Subscription. Then, add a custom transformer with a combination of directives as shown in the image below.
The following table details the function of the directives used:
DirectiveDescription
set-column gdpr_de_vf_email_subscription nullClears any existing value in the Email Subscription field.
set-column gdpr_de_vf_email_subscription event_eventName == "Placed order" ? "yes" : gdpr_de_vf_email_subscriptionSets the Email Subscription field to “Yes” if the event name is Placed order; otherwise, retains the existing value in the Email Subscription field.
As a result, the system will:
  • Clear any existing value in the Email Subscription field and set it to “Null”.
  • When a customer performs the Placed order event, it sets the Email Subscription field to “Yes”. Otherwise, retains the existing value, which is “Null”.
Last modified on February 26, 2026