JavaScript - Outcome Show and Hide

Revision as of 13:14, 21 December 2012 by Philip Lacey (talk | contribs) (Created page with "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 re...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Revision as of 13:14, 21 December 2012 by Philip Lacey (talk | contribs) (Created page with "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 re...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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.

//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();
}