JavaScript - Outcome Show and Hide

From All n One's bxp software Wixi

Jump to: navigation, search

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

//Load up a value from somewhere in the script
var strCDA_X_field_0_1 = document.getElementById('strCDA_X_field_0_1').value;

if (strCDA_X_field_0_1 == 'Sales Query') {
  //If the call is a sales query only add back in one outcome, Sale
  fn_BE_AddOutcome( 'Sale', 'Sale' );
else if (strCDA_X_field_0_1 == 'Go Away'){
  //If the call is a not interested query, we add back in only the Not Interested outcome
  fn_BE_AddOutcome( 'Not Interested', 'Not Interested' );
else {
  //we are not dealing with a specific type.  so we put back in all outcomes.

N.B. Make sure that the values for the outcomes that you pass back in are EXACT matches. Case sensisitvity and spacing make a big difference. Please double then triple check that the text in the strText and strValue are precise