Can we use GlideAjax in ATF server script step for interacting with client side from server side script?

Neha Mohanty
Kilo Contributor

Question1: I need to set values for fields in a record producer and want to achieve it via server side script as i am trying to iterate through multiple categories. Can I use GlideAjax for setting the value in client side using server side script in ATF? Please let me know the steps or provide some sample for help. 

Question 2: Also can we run the ATF steps in loop? like from step 1-7 again it should be repeated? Can we achieve it using server script or any other way?

Note: I don't want to use Step configurations which has set variable steps for record producer. 

 

5 REPLIES 5

Kalaiarasan Pus
Giga Sage

1 - As far as I know, I dont think you can do glideajax in ATF.

2 - I dont think you can do loops in ATF. If I am not wrong, they state this specifically in ATF training on NowLearning.

How can we interact with client side using server side script ? any other way?

SumanthDosapati
Mega Sage
Mega Sage

Hi @Neha Mohanty 

 

We cannot use glideAjax to pass parameter to script include in ATF Run Server side script. 

But you can try this way by splitting your script include into two functions as below.

 

Example existing ajax function in script include :

Ajax_function_name: function() {
		var parameter = this.getParameter('sysparm_parameter');
                /*
                Use that parameter and do something to get output....
                ....
                */
		return output;
	},

	
	

Now split that function into two functions in same script include as below :

//First existing function
Ajax_function_name: function() {
		var parameter = this.getParameter('sysparm_parameter');
		return this.non_Ajax_Function_name(parameter); //calling second function
	},

	
//new second function in same script include
	non_Ajax_Function_name: function(parameter){
		/*
                Use that parameter and get output here same as in first...
                ...
                */
		
		return output;
	},

 

Now in ATF Run server side script step you can call the new second function instead of first function as below :

(function(outputs, steps, stepResult, assertEqual) {

		var ga = new ScriptIncludename().non_Ajax_Function_name(pass parameter here);				
//ga contains the value returned from script include	
		

})(outputs, steps, stepResult, assertEqual);

 

 

Mark as correct or helpful as applicable.

Regards,

Sumanth

So where will u be creating using this Ajax function? Is it separately creating using any ATF step configuration or like normal script include?