- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2020 01:35 AM
For example
function on_test(){
gsftSubmit(null, g_form.getFormElement(), 'test');
}
I want to do some client scripts after calling gsftSubmit() and use some values from server.
I have also tried GlideAjax, however, in my server side scripti I need to use current.update() which is not supported in AJAX script include.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2020 01:54 AM
Hi Phoenix,
I haven't come across scenario where you will write code after gsftSubmit()
that line is used to pass control from client to server only client side script or validations are done
you can have async GlideAjax just before gsftSubmit() is you want to update the record and that script include function will update the record
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
05-04-2020 02:05 AM
Hi Phoenix,
you can pass current record sys_id; then query in script include function with that sys_id on that table; now you have the current record's glide record object; you can update whatever field you want
var sysId = g_form.getUniqueValue();
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
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
05-04-2020 02:10 AM
Thanks a lot.
I will give it a try later.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2020 02:22 AM
After a second thought, I think if you pass the sys_id and query in the script include, you just got an out-of-update record which was exising in DB, but the lastest version of record is in UI.
I think the whole record should be passed, just like what "g_form.getFormElement()" did.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2020 02:31 AM
Hi Phoenix,
then in that case you can send the latest field values by adding them in GlideAjax parameter
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
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
05-04-2020 01:48 AM
Hi,
You may find the below thread helpful.
https://www.servicenowguru.com/system-ui/ui-actions-system-ui/client-server-code-ui-action/
Hope this helps!
Please mark the reply as Helpful/Correct, if applicable.
Regards,
Hemant
