Are there any real use cases for using synchronous GlideAjax?

Suggy
Giga Sage

Are there any real use cases for using synchronous GlideAjax? If yes, can you share the scenarios.

 

Thanks in advance !!!

5 REPLIES 5

Ravi Chandra_K
Kilo Patron
Kilo Patron

Hello @Suggy 

 

Best example is when we are creating an email id. When we enter an email id it checks whether the typed email id is available or not and till then it doesn't allow us to perform any action on the page. This is done using getXMLWait() also called as synchronous call.

 

In Login window, until the username and password are not validated user cannot proceed further.

In a form, if one field in dependent on another field than we can use Synchronous GlideAjax. Such as Location and Time zone. If the user selects the location, then based on location time zone will get populated. So, till the time zone is loading user must wait for the same.

Please refer the below thread:

https://www.servicenow.com/community/developer-forum/scenarios-required-when-to-use-synchronous-and-...

 

Please mark the answer as helpful and correct if helped. 

Kind Regards,

Ravi Chandra  

Jose Manuel
Tera Contributor

I have faced with some scenarios where I need to obtain information from the server before submitting the form to validate some conditions.

but you always can prevent the submission for the first time and then when you get your answer from the ajax, you can submitting manually the same ui action.

Anand Kumar P
Giga Patron
Giga Patron

Hi @Suggy ,

1)Checking if an entered asset tag is unique before submitting the form to prevent duplicate records.

 

2)When user submitting the cmdb requests check the ci exists in table then proceed next.

 

 

Refer below link: 

 

https://www.servicenow.com/community/developer-articles/getxmlwait-alternative-for-service-portal/ta...

 

If my response helped, please mark it as the accepted solution and give a thumbs up👍.
Thanks,
Anand

@Anand Kumar P Thanks for the replying.

Considering this example:

1)Checking if an entered asset tag is unique before submitting the form to prevent duplicate records.

 

This can be done using OnChange client script + Ajax (ofcourse validation happens before form submit)

OR

use the before insert/update Business rule (validation happens after form submit)

 

May I know which is the preferred method? Using client script or BR? Rationale behind it.

 

PS - My understanding is, we should not prefer synchronous GlideAjax, BR's preferred. Glideajax is preferred only in asynchronous scenarios.

Just looking to hear from others 🙂