Difference between revisions of "JavaScript - Outcome Show and Hide"
From All n One's bxp software Wixi
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...") |
Philip Lacey (talk | contribs) |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 23: | Line 23: | ||
var strCDA_X_field_0_1 = document.getElementById('strCDA_X_field_0_1').value; | var strCDA_X_field_0_1 = document.getElementById('strCDA_X_field_0_1').value; | ||
| − | |||
| − | |||
if (strCDA_X_field_0_1 == 'Sales Query') { | 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' ); | fn_BE_AddOutcome( 'Sale', 'Sale' ); | ||
} | } | ||
else if (strCDA_X_field_0_1 == 'Go Away'){ | 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' ); | fn_BE_AddOutcome( 'Not Interested', 'Not Interested' ); | ||
} | } | ||
| Line 36: | Line 36: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| + | |||
| + | 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 | ||
| + | |||
| + | |||
| + | [[Category:Module Specific:Form Management]] | ||
| + | [[Category:Topic:JavaScript]] | ||
Latest revision as of 02:52, 22 March 2014
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 (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.
fn_BE_ResetOutcomes();
}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