Expand my Community achievements bar.

Adobe Campaign User Groups are live now. Join our Adobe Campaign User Groups and connect with your local leaders!

Tuesday Tech Bytes – Adobe Campaign Classic – Week 01 – Tips & Tricks

Avatar

Community Advisor

7/9/24

Tips & Tricks

Initialization script

An initialization script is executed when the activity is activated and can be used to initialize variables and to modify the properties.
There are few Community questions which has been answered by solving the issue using Initialization script. Below are few of the examples of how to solve a use case using Initialization script:
There are few limitations in Adobe campaign UI. Example, we can only hardcode the value of segment code in Split activity. If there is a scenario to pass a dynamic value in segment code section, then the TRICK is, create a split activity > configure the subsets label and save the workflow. Now right click somewhere on the workflow and select 'Edit XML Source...'

ParthaSarathy_0-1720547463570.png

 

Search with the subset's label. There will be an XML as below,

 

    <extract collision="0" img="nms:activities/piechart.png" label="Split" mainSet=""
             mask="0" name="extract" onError="0" runOnSimulation="true" schema="nms:recipient"
             timezone="_inherit_" x="648" y="72">
      <transitions>
        <extractOutput code="" enabled="true" label="Subset1" name="extractOutput"
                       recipientLink="" schema="nms:recipient">
          <limiter percent="10" type="percent"/>
        </extractOutput>
		<extractOutput code="" enabled="1" label="Subset2" name="extractOutput2">
          <limiter defaultLimit="100" percent="10" type="percent"/>
        </extractOutput>
        <done enabled="false" label="Result" name="done"/>
        <remainder enabled="0" label="Complement" name="remainder"/>
      </transitions>
    </extract>

 

 

Here the root tag <extract> is for Split activity. As we are going to write the script in initialization script part inside the split activity, replace 'extract' with 'activity' and write the script as below,

 

activity.transitions.extractOutput[0].code = vars.subset1_variable;

 

 

If there are multiple subsets, then add one more line and modify it as extractOutput[1], extractOutput[2] and so on...

 

//Subset 1
activity.transitions.extractOutput[0].code = vars.subset1_variable;

//Subset 2
activity.transitions.extractOutput[1].code = vars.subset2_variable;

//Subset 3
activity.transitions.extractOutput[2].code = vars.subset3_variable;

 

 

Similarly we can modify the configurations of any activity by initialization script and to get the script, Just right click the workflow and select 'Edit XML Source...' and search for the activity root tag in it.

1 Comment