UI action throwing error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2025 06:30 AM
Hi all,
I might have the most stupid question, which I hope you can explain the reason. I'm trying to create a Client callable UI action with both client side and server side code in it. The setup is like this:
Where the code written is (currently just some test code):
function onCLickConvertGsr() {
var answer = confirm("Are you sure?");
if (answer) {
gsftSubmit(null, g_form.getFormElement(), 'ConvertGsr');
}
}
if (typeof window == 'undefined') {
ConvertGsr();
}
function ConvertGsr() {
var incGr = current;
incGr.state = 8;
}
When trying to save this i get this error:
Can one of you explain the reason for this?
@Ankur Bawiskar - do you might have a good idea here?
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.
Best regards
Anders
Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2025 06:56 AM
did you try creating fresh UI action?
Also you can directly assign the value using current and you forgot to update
Ensure no before update BR stops the form submission
function ConvertGsr() {
current.state = 8;
current.update();
}
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2025 07:09 AM
Hi @Ankur Bawiskar ,
thanks for the comment. Other than the minor corrections to the server side, have you then seen such an issue before or having any knowledge around why such an issue could occur?
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.
Best regards
Anders
Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2025 07:12 AM
Nope, haven't seen this issue.
Could be an intermittent connection or instance issue.
Anyhow it's PDI and PDIs are highly unstable and no guarantee on their behavior.
Try clearing instance cache using cache.do
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Dear Andres, The possible reasons You are seeing the error page because:
/< gsftSubmit() invokes server execution
Server-side logic is incomplete (update() missing)
Minor JS naming/case issues
Mixed client/server code not cleanly separated
Fix:
Use proper typeof window === 'undefined'
Update the record explicitly
Keep the script minimal and platform-standard />
The attached script is the revised version has the fix:
Properly separates client and server execution
Avoids function nesting issues
Uses the standard </gsftSubmit() /> pattern
Fixes the error you are seeing in the snapshot
- Java script is case sensitive CLick instead Click
Let me know how this has worked for you. Best of Luck I am eager waiting to hear from you.
