1,255 bytes added,
13:14, 21 December 2012 There may be instances where you wish to change the outcomes that appear in a campaign based on certain criteria occuring. So if a brochure request, only show the brochure request outcome. If a sale, only show the Sale outcome and so on.
So lets start with a few outcomes. By default in our example we have 3 outcomes.
* Brochure Request
* Not Interested
* Sale
By default the script will fill the outcomes. There are some very handy prebuilt javascript functions to help with this functionality.
* fn_BE_BlankOutcomes()
* fn_BE_AddOutcome( strText, strValue )
* fn_BE_ResetOutcomes()
Using the details would be something along the lines of.
<syntaxhighlight lang="javascript" line start="1">
//Blank all the outcomes
fn_BE_BlankOutcomes();
//Load up a value from somewhere in the script
var strCDA_X_field_0_1 = document.getElementById('strCDA_X_field_0_1').value;
//If the call is a sales query only add one outcome Sale
if (strCDA_X_field_0_1 == 'Sales Query') {
fn_BE_AddOutcome( 'Sale', 'Sale' );
}
else if (strCDA_X_field_0_1 == 'Go Away'){
fn_BE_AddOutcome( 'Not Interested', 'Not Interested' );
}
else {
//we are not dealing with a specific type. so we put back in all outcomes.
fn_BE_ResetOutcomes();
}
</syntaxhighlight>