Server-side UI Actions execute in a different context than the form display, so changes made to records won't automatically refresh the form the user is viewing. The platform doesn't push server-side field updates back to the client form — you must explicitly force a reload using action.setRedirectURL() or handle it client-side with GlideAjax plus a manual reload. Most developers expect the form to automatically reflect server changes and are surprised when stale data remains visible.

When to use this

  • Server-side UI Actions that modify the current record and need the user to see updated field values immediately
  • Bulk operations that update multiple fields and calculated values that won't be visible until refresh
  • Actions that trigger Business Rules or other server-side logic that changes form state
  • When the user needs to see updated sys_mod_count or audit fields after the server-side update

When NOT to use this

  • Don't use action.setRedirectURL() for simple field updates that could be handled with client-side g_form.setValue()
  • Don't redirect if the action should navigate to a different record or list — use the target URL instead
  • Don't use this pattern for actions that only display messages without changing data — use gs.addInfoMessage() instead
  • Don't use full page reloads for high-frequency actions — consider client-side updates with GlideAjax for better performance

Key behaviors and gotchas

  • action.setRedirectURL() only works in server-side UI Actions — it's not available in client-side scripts
  • The redirect happens after all server-side processing completes, so you can safely update records before calling it
  • Use the full form URL format table.do?sys_id=value — relative paths or sys_id alone won't work reliably
  • Any unsaved form changes are lost during the redirect — warn users or validate required fields first
  • The redirect creates a new browser history entry — users can navigate back to the pre-update form state
  • window.location.reload() in client scripts preserves form changes but requires Ajax communication with the server first
⚠️

Never call action.setRedirectURL() multiple times in the same UI Action — only the last call takes effect, and you won't get an error if earlier calls are overwritten.

Free Newsletter

Enjoying this? Get one deep-dive per week.

Join 1,000+ ServiceNow pros — scripts, GlideRecord patterns, Flow Designer techniques, and career moves. Free.

No spam · Unsubscribe anytime