The CreatorCon Call for Content is officially open! Get started here.

Run GlideAjax on Record Producer

Kyle Wiley
Mega Expert

I need to be able to run a GlideAjax based on two field values on a Record Producer that is being entered and have the calculation run and fill out another field on the Record Producer, so the processing is not being done on the form itself.  Here is an example of the data:

find_real_file.png

Each of these reference records has a string field that has the numbers that I need in order to concatenate into a value that I can use to query another table that contains a record equal to this Department and Job Code combination:

find_real_file.png

Once I have the query, the record itself has a List field that I need to display on the record producer once the user has answered a certain question, via an onChange client script.

Can anyone provide some help with this? 

 

3 REPLIES 3

Gajanan Birada1
Giga Expert

Hi,

 

so you want to write glideajax right?

 

so first whatever enter into first field get that value in variable.

 using glide ajax sent that parameter to script include like 

 

var a = new GlideAjax('your script include name');

a.addParm('sysparm_name','function_name');

a.addParam('sysparm_yourvaraibale_value',' send parameter' );

 

a.getXML(getanswer);

 

function getanswer(response)

{

var answer = response.responseXML.documentElement.getAttribute('answer');

}

 

 

//script include

 

take that parameter which was send by client script 

glide to another table and use addquery to match that department id and return to client script 

in client script save to setvakue.

 

thank you

gajanan Biradar

 

Yes, I have done that for another script and it works great but I am using that script to grab data that is on the user's profile that is being entered in the Record Producer, so I am grabbing the user and doing the query based on information in the user's profile, so the query processing is being done with data not on the form. 

The issue I am running into, is I need to use the data from two different fields that are on the Record Producer, then use that information to run the query off-form through the GlideAjax, then bring the info back to the form but I don't know how to move the data from two separate fields to the GlideAjax since it is two separate fields.

You can send more than one parameter through to the GlideAjax call. Just specify additional addParam statements. Make sure your script include is ready to accept the additional parameters (etc. function script_include(param1,param2)) and you should be good to go.

...

a.addParam('sysparm_yourvariable_value1',' send parameter1' );

a.addParam('sysparm_yourvariable_value2',' send parameter2' );

 

Hope this helps.

Ben