Expand my Community achievements bar.

SOLVED

Enable/Disable Campaign Control Group Dynamically

Avatar

Level 2

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 ? 

 

test_143_0-1680693290442.png

Thanks,

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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/

View solution in original post

6 Replies

Avatar

Community Advisor

Hello @_vikas_ ,

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

Marcel_Szimonisz_0-1680700807517.png

 

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.

Marcel_Szimonisz_0-1680717519084.png

 

 

 

 

<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_1-1680701363444.png

 

Marcel Szimonisz

Avatar

Level 2

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!

Avatar

Community Advisor

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

 

Avatar

Level 2

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 !

 

Avatar

Correct answer by
Community Advisor

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/

Avatar

Level 2

Thanks @Marcel_Szimonisz, this worked for me. Appreciate your responses on this issue.