using glide ajax and client scripts to populate values to meet the requirement

Hitesh Ramba
Tera Contributor

I have a field project category on both project form and timecards form . If i select a porject categiory on the project form it must autopopolate on the timesheet form automatically .
How can i solve this .\?

 

 

Thanks

Hitesh

1 REPLY 1

johnfeist
Mega Sage
Mega Sage

Hi Hitesh,

 

The way that you use Glide Ajax is by doing a setup in your client script that calls a function in a client callable script include.  The script does whatever lookup, etc. is needed and returns a result (via a return statement).

 

The call includes the name of a callback function as an argument.  Here's a simple client script:

var ga = new GlideAjax('MyScript');  //holds name of hte script include
ga.addParam('sysparm_name', 'calculateFinancialMeasures');  //name of the function to execute
ga.addParam('sysparm_opCost',opCost);  //some other parameter
ga.getXML(serverAnswer);
	
function serverAnswer(response) {
	var answer = response.responseXML.documentElement.getAttribute("answer");	
		

Once you have the returned value in answer, you do whatever other processing is needed.

 

To access the parameters that you pass, other than script and function names, use this syntax

 

var someValue = current.getParam("<param name>");  //the name is the first arguement is the ga.addParam

 

Ajax runs asynchronously so that the browser doesn't have a momentary freeze.

 

Hope that helps.

:{)

Helpful and Correct tags are appreciated and help others to find information faster