September 2017
Intermediate to advanced
408 pages
9h 25m
English
When we write scripts in business rules, we should take extra steps to enclose all our code within a function to limit the scope of objects. If we do not encode the code within a function, any variable and other objects will be accessible from other server-side scripts, such as a script include. Consider the following code:
var gr = new GlideRecord("problem");
gr.addActiveQuery();
gr.query();
The preceding code defines an instance of the GlideRecord object named gr. If the code is not enclosed within a function, the gr object will be available in other server-side scripts, which can cause unexpected results and make things very difficult to debug. Hence, we must ensure that the code is properly enclosed within a function ...
Read now
Unlock full access