Call back function in client scripts

RudhraKAM
Tera Guru

I have a client script in which i need to use call  callback function so that it will work on Portal . Can someone help 

function onLoad() {	
	adjustVariables();
			function adjustVariables(){
		//variables to be hidden need to be not mandatory before setting display to false.
		g_form.setMandatory("requester_information",false);
		g_form.setDisplay("requester_information",false);
		
		g_form.setReadOnly("csv_tenant_request", true);
		
		// Set Current Values
		var volume = g_form.getReference("csv_tenant_request", setCurrentValues);
		
			g_form.setValue("csv_current_account_owner", volume.u_account_owner);

			
			g_form.setReadOnly("csv_current_account_owner", true);
		
		}
	}
}
1 ACCEPTED SOLUTION

below is callback function

you can't dot walk on client script direct so you have to use callback function. 

var volume = g_form.getReference("csv_tenant_request", setCurrentValues);

 

// Set Current Values
		var volume = g_form.getReference("csv_tenant_request", setCurrentValues);
		
		function setCurrentValues(volume) {
			g_form.setValue("csv_current_account_owner", volume.u_account_owner);
			g_form.setReadOnly("csv_current_account_owner", true);
		}	

View solution in original post

3 REPLIES 3

Mike Patel
Tera Sage

try

function onLoad() {	
	adjustVariables();
	function adjustVariables(){
		//variables to be hidden need to be not mandatory before setting display to false.
		g_form.setMandatory("requester_information", false);
		g_form.setDisplay("requester_information", false);
		g_form.setReadOnly("csv_tenant_request", true);

		// Set Current Values
		var volume = g_form.getReference("csv_tenant_request", setCurrentValues);
		
		function setCurrentValues(volume) {
			g_form.setValue("csv_current_account_owner", volume.u_account_owner);
			g_form.setReadOnly("csv_current_account_owner", true);
		}	
	}
}

Thanks Mike 

 

Can you please tell me what exactly the call back will do ? 

below is callback function

you can't dot walk on client script direct so you have to use callback function. 

var volume = g_form.getReference("csv_tenant_request", setCurrentValues);

 

// Set Current Values
		var volume = g_form.getReference("csv_tenant_request", setCurrentValues);
		
		function setCurrentValues(volume) {
			g_form.setValue("csv_current_account_owner", volume.u_account_owner);
			g_form.setReadOnly("csv_current_account_owner", true);
		}