Enable/Disable Campaign Control Group Dynamically | Community
Skip to main content
Level 2
April 5, 2023
Solved

Enable/Disable Campaign Control Group Dynamically

  • April 5, 2023
  • 1 reply
  • 2019 views

Team,

I am trying setup control group through a workflow but getting below error. Is there another way to enable/disable control group for all deliveries in a campaign through JS or Update Data activity ? 

 

Thanks,

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Marcel_Szimonisz

Can this implementation be independent of campaign ? I want this to be a standalone process and not part of campaign workflow. In this case, can I access delivery control group parameters outside campaign ? Is this possible ?

 

Thanks @marcel_szimonisz !

 


Templates are independed from campaigns and created outside of worklfow when you use delivery activity :). Only time when you would need more independency is when you use same template for multiple campaigns and you want different settings for each delivery send. If you want to have it independed set on campaign. Then save this field on  campaign (nms:operation) schema and check on the field in the same script. Now you will get  campaign id from actual running workflow and then use load JSAPI function to load campaign object.

 

 

 

var campaign = NLWS.nmsOperation.load(instance.operation_id) || false; if(campaign && campaign.controlGroup == true) //enable and set else //disable

 

 

 

Marcel Szimonisz

MarTech Consultant
for more tips visit my blog
https://www.martechnotes.com/

1 reply

Marcel_Szimonisz
Community Advisor
Community Advisor
April 5, 2023

Hello @vikasna ,

you can set up control group on the delivery activity in Script tab (it is also availble in other delivery activities)

 

Where you can access and read or set any property of a delivery. Control group can be accessed on path:

 

 

 

delivery.execution.controlGroup delivery.execution.controlGroup.enabled = false//true delivery.execution.controlGroup.percentage = 10; delivery.execution.controlGroup.type = 1; // need to map the options to type --> random sampling etc

 

 

 

How to know what variables you need to check for a particular control group settings you want to apply?

You need to go and set the control group to what you require in the UI. Save delivery and navigate to "Edit --> Edit XML source"  to see what fields have what values in XML and set them in script as needed.

 

 

 

 

<execution> <controlGroup activeOrder="0" enabled="true" fixed="10" percentage="10" schema="nms:recipient" type="1"> <humanConfig>Random sampling with size limited to 10 %</humanConfig> <where filteringSchema="nms:recipient"/> </controlGroup> </execution>

 

 

 

If you want to set the control group for multiple deliveries in the workflow you can add settings to instance variables and place them to be at the begining of the workflow. Where you set your control group variables and then refer them in each of the delivery scripts.

 

 

Marcel Szimonisz

VikasNaAuthor
Level 2
April 5, 2023

Thanks @marcel_szimonisz for the quick reply, appreciate it.

 

This will not work entirely for my use case.

My requirement is - to apply/not apply control group depending on a custom attribute at each delivery level dynamically, Client doesnt want to configure Control Group manually each time. This custom attribute is defined under delivery properties. If custom_attribute = 'x', enable Control Group parameters, else dont. 

So, I am planning to invoke a SOAP function from Campaign form that will call a JS file to update control group parameters on delivery schema but Im not able to access control group parameters in JS file as they are XML fields and not SQL. 

 

Please let me know if there is a way to achieve this functionality. Thanks!

Marcel_Szimonisz
Community Advisor
Community Advisor
April 5, 2023

then you can read that paramater and switch on control group or not its just another implementation of the same feature. When you create new field to delivery schema and set it in the template you can read it in the campaign worfklow and action upon it.

 

if (delivery.customParameterWhetherControlGroupIsOn) //enable else //disable