Can we do one GlideAjax call from callback function on another GlideAjax in onSubmit client script

MohsinT
Kilo Contributor

I have requirement to fetch request state from server on client side. Based on state of request, need to update few fields to other table on submit of form.

I am using Onsubmit client script, Used 1st GlideAjax call to fetch state of request (request is reference field). Inside call back, if request state is approval, need to update few fields. For this doing 2nd GlideAjax call. But this 2nd call is not working at all, it is not going to script include mentioned in glideajax. 

Need to know if we can do one GlideAjax call from callback function on another GlideAjax in onSubmit client script. If yes, how?

3 REPLIES 3

HrishabhKumar
Kilo Sage

Hi @MohsinT ,

Yes we can do that, although it's not a good practice to use GlideRecord in client script. Can you paste your code for the reference, so that I can troubleshoot. 

Please share both Script include and client script code.

 

Thanks.

Dnyaneshwaree
Mega Sage

Hello @MohsinT ,

Use that logic in script include using multiple functions and call it from client script.
Please refer below article for the same:
https://www.servicenow.com/community/developer-forum/can-i-use-one-glideajax-to-call-several-functio...

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

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

Johannes Mweli
Giga Guru

Hi MohsinT,

 

I am running into exactly the same issue you described here, did you ever figure this out? If so what was your solution? Please advise.

 

Thanks,

Johannes