Declared variable is getting grade out, Seems like not working, But when it is pasted here its worki

darsikumar
Tera Contributor

 

function onLoad() {

	
 alert('test 1');  
    var inc = g_form.getReference('requested_for', callBack);
 alert('test');
function callBack(inc) {
	aler('test 2');
    if (inc.city == 'China') {
        alert(inc.city);



    }
	}
	}

 

1 REPLY 1

Dnyaneshwaree
Mega Sage

Hello @darsikumar ,

The variables declared above the callback function was might not accessible in the code below the function. I have faced same with for your code. I have try to use different name of the variable call in function then looking like simple form and also change the position of the declaration of variable then also looks good. 
Please check and update it accordingly.

Dnyaneshwaree_0-1719303161800.png

Dnyaneshwaree_1-1719303226731.png


Please mark helpful and accept my solution if it is helps you any way.

Thank You!!

 

Please accept my solution if it works for you and thumps up to mark it as helpful.
Thank you!!

Dnyaneshwaree Satpute
Tera Guru