
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2020 06:52 AM
Hi guys, i have glide ajax script and it works fine, but I have a problem with reloading form from script include, or in ui action but after glide ajax finished, how is it possible?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2020 07:59 AM
Hi,
can you try this
// ui action
function moveToCloseState() {
var sys_id = g_form.getUniqueValue();
var ga = new GlideAjax('incident');
ga.addParam('sysparm_name', 'setCloseState');
ga.addParam('sysparm_id', sys_id);
ga.getXML();
var url = '/' + g_form.getTableName() + '.do?sys_id=' + sys_id;
top.location.href = url;
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2020 06:55 AM
This brings up all kinds of questions in my mind. What is the use case you are trying to accomplish? What's the business requirement?
Noting that GlideAjax happens async, updates info on the form makes me wonder why the form needs to be reloaded, or why you are using GlideAjax if you need the form refreshed for some other reason. The Async nature of GlideAjax also makes it difficult to know when to actually refresh.
Can it be done, I'm sure there's a way. SHOULD it be done, or is there a better way requires more understanding of the context of what you are trying to accomplish (beyond what you posted above.)
Thanks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2020 07:19 AM
Hi Chuck, thanks for your answer, I have no state field on the incident form, and I need to move incident in the close state with UI Action, I'm using glide ajax to pass a parameter of my form, in the script include I'm using update() method and I see all changes only after reloading the form, to do my form more user friendly, i would like to reload after state changed;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2020 07:23 AM
You can try using location.reload();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2020 07:45 AM
Hi, thanks for your answer, still doesn't work