- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2016 07:51 AM
Hi: We have the following script in our 'Resolve Now' UI action that is called every time the user clicks the 'Resolve Now' button:
if (typeof window == 'undefined') {
serverResolve();
}
I am wondering if something is wrong with the code. What is window == 'undefined'? Is it always 'undefined'? When is it 'defined'?
Thanks for your help!
Rita
Solved! Go to Solution.
- 29,318 Views

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2016 05:39 AM
Hi Rita,
if(typeof window == 'undefined') means
1.Code that runs without 'onclick'.
2.Ensure call to server-side function with no browser errors

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2016 05:39 AM
Hi Rita,
if(typeof window == 'undefined') means
1.Code that runs without 'onclick'.
2.Ensure call to server-side function with no browser errors
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2016 05:44 AM
Hi Pradeep: Yes that makes sense. So the code in the if always executes unless there are browser errors. Thx! Rita
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2016 11:18 PM
Hi Pradeep,
For my instance UI action 'Resolve Incident' also has onclick value - resolveIncident(); and this function has body in the script section. And your comment says "1.Code that runs without 'onclick'." how exactly it works? I am stuck for that point.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2016 11:28 PM
Hi Shreya,
Please go through below link for more info on how it works.
Client & Server Code in One UI Action - ServiceNow Guru
Let me know if you have any questions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2016 02:04 AM
Thank you so much.. Now I am much clearer with this idea.. Thanks.