isLoading in UI Policy Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2018 11:42 AM
In onChange Scripts we can use the isLoading variable to determine if the form has been loaded or is still loading. I tried to use that variable in an UI Policy, but it is undefined there. Is there a similar variable that can be used in UI Policy Scripts? Would it be save to use document.readyState for this purpose?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2018 01:15 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2018 01:20 AM
Use case is this:
- Field A should become visibile if a specific combination of Category and Subcategory is fulfilled. (onLoad and onChange)
- If Field A becomes visibile due to form changes by user and it is empty it shall be prefilled with a specific value, which can be overridden by the user
- If Field A is already visibile after form load but empty it should not be prefilled again (because user might have cleared the prefilled field before)
So basically the UI Policy Action which makes Field A visible should be run onLoad and onChange and the UI Policy Script to prefill Field A should only be run onChange.
Anyway I figured out that I it seems to build my own "isLoading" variable with var isLoading = (document.readyState === "loading") . That seems to work perfectly fine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2018 01:19 PM
Thank you for the solution of building your own "isLoading".
Unfortunate how this isn't stated explicitly anywhere on the ServiceNow docs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2024 08:05 AM
bump