- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2017 09:16 AM
Hi,
I'm fixing some ACE report codes, most of them the used wrong the getReference method without a callback function... I've noticed that on service now wiki they use in this way(they removed the isLoading condition):
I've been using this on my scripts to fix the ace report bad practice issue, however I would like to know if keeping the following statement will affect the script, does this do any change?
if (isLoading){
return;
}
Solved! Go to Solution.
- Labels:
-
Best Practices
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2017 09:27 AM
you absolutly can remove that and the if newvalue == '' line depending on what the code is doing/for...
the onloading section prevents the code from running just because the page loaded <technically the value DID change on load>
the newvalue test stops the code if the value is blanked out...
again examine what you WANT the code to do.. if it SHOULD run on load before they have a chance to touch the value take it out... however normally it is best to leave that in so the page loads quicker.. same with the new value test.. if a blank value requires an action remove it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2017 09:25 AM
Hi Guille,
The lines of code are to ensure that no script runs when the page or form is loading.This is to ensure faster loading time. Please check section 9.2 at
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2017 09:28 AM
So if It won't affect the get Reference call? I just wanted to double check at the image above Servicenow removes it. so If I add it again it wont lift an ACE report flag?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2017 09:32 AM
If you have no specific code that you need to run when the form loads, removing it shouldn't matter.
Regards
Darshak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2017 09:27 AM
you absolutly can remove that and the if newvalue == '' line depending on what the code is doing/for...
the onloading section prevents the code from running just because the page loaded <technically the value DID change on load>
the newvalue test stops the code if the value is blanked out...
again examine what you WANT the code to do.. if it SHOULD run on load before they have a chance to touch the value take it out... however normally it is best to leave that in so the page loads quicker.. same with the new value test.. if a blank value requires an action remove it.