399
edits
Changes
→Step 4. Create the Self-Referencing Function.
</syntaxhighlight>
== Step 4.1. Create the Self-Referencing Function for use on an on change event on a (Text box,Drop down list, etc). ==
You need to modify the code below for it to work for you.
This gets placed in the JavaScript onLoad of the campaign.
Main Menu > Database Management > Database - Primary Details > Campaign - Edit > Choose your campaign > JavaScript onLoad subsection > Opening Code execution box.
<syntaxhighlight lang="javascript">
function fn_SelfReferencing() {
if (typeof aryAjax_Settings=='undefined')
alert('Library did not load');
else {
aryAjax_Settings[0] = 'client_XXXXXXX';//CLIENT NAME
aryAjax_Settings[1] = '';//ext username
aryAjax_Settings[2] = '';//ext password
aryAjax_Settings[3] = ' ';//ID OF THE CAMPAIGN TO LOOK UP IN
aryAjax_Settings[4] = ' ';//FIELD THAT YOU WANT TO SEARCH ON EG NAME OR PRODUCT CODE
aryAjax_Settings[5] = document.getElementById(' ').value;//THE FIELD THAT YOU WANT IN THE CURRENT CAMPAIGN EG IN CAMPAIGN (458) THE FIELD THAT YOU WANT TO PASS ON TO THE OTHER CAMPAIGN TO SEARCH ON
aryAjax_Settings[13] = '-1';
aryAjax_Settings[14] = 'true';
aryAjax_Settings[15] = 'strHistory';
aryAjax_Settings[6] = 'strCDA_XXXX_field_X_X,strCDA_XXXX_field_X_X,strCDA_XXXX_field_X_X';//FILDS IN THE OTHER CAMPAIGN THAT YOU WOULD LIKE TO TO FILL IN THE OTHER CAMPAIGN
aryAjax_Settings[12] = 'Id,Nom produit,Libellé marque,Famille';
aryAjax_Settings[16] = 'Insert';
aryAjax_Settings[17] = 'strCDA_458_field_X_X,strCDA_XXXX_field_X_X,strCDA_XXXX_field_X_X';//FILDS IN THE CURRENT CAMPAIGN THAT YOU WOULD LIKE TO BE FILLED IN FROM THE OTHER CAMPAIGN
aryAjax_Settings[22] = document.getElementById('intSystemGenerated_CompanyId').value; //Auto Login - System
aryAjax_Settings[23] = document.getElementById('intSystemGenerated_UserId').value; //Auto Login - User
aryAjax_Settings[24] = document.getElementById('intSystemGenerated_LoginKey').value; //Auto Login - SessionId
fn_Ajax_BE_Process();
}
setTimeout(function() {
fn_CheckNull();
},550);
}
//************************************************************************************************************************************************
function fn_CheckNull(){
var strCDA_XXXX_field_0_9 = document.getElementById('strCDA_XXXX_field_X_X');//FIELD IN THE CURRENT CAMPAIGN THAT HAVE BEEN FILLED
var strCDA_XXXX_field_0_10 = document.getElementById('strCDA_XXXX_field_X_X');//FIELD IN THE CURRENT CAMPAIGN THAT HAVE BEEN FILLED
if((strCDA_XXXX_field_X_X.value == '')&&(strCDA_XXXX_field_X_X.value == '')){//FIELD IN THE CURRENT CAMPAIGN THAT HAVE BEEN FILLED, YOU CAN USE ONE OR TWO FILEDS THAT YOU KNOW ARWE FILLED IN SO YOU CAN TELL IF THE RECORD WAS THERE
alert('NOT FOUND');
}
}
</syntaxhighlight>
== Step 5. Call the Self-Referencing Function. ==