Vancouver - Server side Scripting Flashcards

1
Q

After Business Rules execute their logic _ after a database operation occurs and before the resulting form is rendered for the user. Use after Business Rules when __ ___ are needed to the record being accessed in the database.

A

After Business Rules execute their logic immediately after a database operation occurs and before the resulting form is rendered for the user. Use after Business Rules when no changes are needed to the record being accessed in the database.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

For example use _ Business Rules to invoke web services through the REST API. Service level agreement (SLA) calculations are also typically done as _ Business Rules.

A

For example use async Business Rules to invoke web services through the REST API. Service level agreement (SLA) calculations are also typically done as async Business Rules.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

_ Business Rules execute their logic when a form loads and a record is loaded from the database. They must complete execution before control of the form is given to a user. The purpose of a _ Business Rule is to populate an automatically instantiated object, _ The object is passed from the _ Business Rule to the client-side for use by client-side scripts. Recall that when scripting on the client-side, scripts only have access to fields and field values for fields on the form and not all of the fields from the database. Use the _ object to pass data to the client-side without modifying the form. The _ object has no default properties.

A

Display Business Rules execute their logic when a form loads and a record is loaded from the database. They must complete execution before control of the form is given to a user. The purpose of a display Business Rule is to populate an automatically instantiated object, g_scratchpad. The g_scratchpad object is passed from the display Business Rule to the client-side for use by client-side scripts. Recall that when scripting on the client-side, scripts only have access to fields and field values for fields on the form and not all of the fields from the database. Use the g_scratchpad object to pass data to the client-side without modifying the form. The g_scratchpad object has no default properties.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Business Rule Actions are a configurable way to:

_
_
_

A

Business Rule Actions are a configurable way to:

Set field values
Add a message to a form
Abort the Business Rule execution

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

The ___ ___ option stops execution of the Business Rule and aborts the database operation. When the ___ ___ option is selected, you can use the Add Message option to print a message to the screen but no other options are available. Use this option when the script logic determines the database operation should not be performed.

A

The Abort action option stops execution of the Business Rule and aborts the database operation. When the Abort action option is selected, you can use the Add Message option to print a message to the screen but no other options are available. Use this option when the script logic determines the database operation should not be performed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

This is ___ syntax for a condition script:

current.short_description == “Hello world”

A

This is CORRECT syntax for a condition script:

current.short_description == “Hello world”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

This is ___ syntax for a condition script:

if(current.short_description == “Hello world”){}

A

This is INCORRECT syntax for a condition script:

if(current.short_description == “Hello world”){}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Some example condition scripts:

The value of the State field changed from anything else to 6:
current.state.changesTo(6)

The Short description field has a value:
!current.short_description.nil()

The value of the Short description field is different than when the record was loaded:
current.short_description != previous.short_description

A

These are all correct ways to write a condition script

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

When scripting, use dot-walking to retrieve or set field values on related records. The syntax is:

<___>.<___>.<___>
For example:

if(current.u_requested_for.email == “beth.anglin@example.com”){
//logic here
}

A

When scripting, use dot-walking to retrieve or set field values on related records. The syntax is:

<object>.<related_object>.<field_name>
For example:

if(current.u_requested_for.email == "beth.anglin@example.com"){
//logic here
}
</field_name></related_object></object>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does API stand for

A

Application Programming Interface

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

To use methods from the GlideSystem class, use the gs object:

A

To use methods from the GlideSystem class, use the gs object:

gs.<method></method>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are the following:

Numbers: =, !=, >, >=, <, <=
Strings: =, !=, STARTSWITH, ENDSWITH, CONTAINS, DOES NOT CONTAIN, IN, NOT IN, INSTANCEOF

A

Use the addQuery() method to add query conditions. The addQuery operators are:

Numbers: =, !=, >, >=, <, <=
Strings: =, !=, STARTSWITH, ENDSWITH, CONTAINS, DOES NOT CONTAIN, IN, NOT IN, INSTANCEOF

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

The next() method along with what iterates through all returned records to process script logic?

A

The next() method and a while loop iterates through all returned records to process script logic:

// iterate through all records in the GlideRecord and set the Priority field value to 4 (low priority).
// update the record in the database
while(myObj.next()){
myObj.priority = 4;
myObj.update();
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

The next() method along with what processes only the first record returned

A

The next() method and an if processes only the first record returned.

// Set the Priority field value to 4 (low priority) for the first record in the GlideRecord
// update the record in the database
if(myObj.next()){
myObj.priority = 4;
myObj.update();
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How do you update all the records processed by a glide record. What is the other caveot when using the method?

A

Use the updateMultiple() method to update all records in a GlideRecord. To ensure expected results with the updateMultiple() method, set field values with the the setValue() method rather than direct assignment.

// When using updateMultiple(), use the setValue() method.
// Using myObj.priority = 4 may return unexpected results.
myObj.setValue(‘priority’,4);
myObj.updateMultiple();

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

The GlideRecord API has a method for counting the number of records returned by a query: ___. Do not use the ___ method on a production instance as there could be a negative performance impact on the database. To determine the number of rows returned by a query on a production instance, use ___.

A

The GlideRecord API has a method for counting the number of records returned by a query: getRowCount(). Do not use the getRowCount() method on a production instance as there could be a negative performance impact on the database. To determine the number of rows returned by a query on a production instance, use GlideAggregate.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Where will the following message be displayed?

gs.error(“The value of the Short description field is “ + short_description);

A

gs.error(“The value of the Short description field is “ + short_description);

To view the log messages, use the All menu to open System Logs > System Log > Application Logs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

The scoped GlideSystem API has logging methods:
1._
2._
3._
4._(must be enabled)

A

The scoped GlideSystem API has logging methods:

gs.info()
gs.warn()
gs.error()
gs.debug() (must be enabled)

These can all be seen in the application log, though the gs.debug must be enabled first

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

To debug a Condition field script, enable:

A

To debug a Condition field script, enable detailed Business Rule Debugging.

20
Q

Use the ___ tab in the Script Debugger to debug synchronous, server-side scripts which are executed as part of an application’s logic.

A

Use the Script Tracer tab in the Script Debugger to debug synchronous, server-side scripts which are executed as part of an application’s logic.

21
Q

The ___ is the primary strategy for debugging Business Rules and other synchronous server-side scripts.

  • Set, remove, and pause at breakpoints
  • Step through code line-by-line
  • Step into and out of functions and method calls
  • View the values of local, global, and private variables
  • View the call stack
A

The Script Debugger is the primary strategy for debugging Business Rules and other synchronous server-side scripts.

  • Set, remove, and pause at breakpoints
  • Step through code line-by-line
  • Step into and out of functions and method calls
  • View the values of local, global, and private variables
  • View the call stack
22
Q

The _ shows list of methods and functions called to run as part of the script execution. Click an item in the _ to see the definition. Execution must be paused at a breakpoint to examine the _.

A

The call stack shows list of methods and functions called to run as part of the script execution. Click an item in the call stack to see the definition. Execution must be paused at a breakpoint to examine the call stack.

23
Q

What are logpoints

A

Logpoints allow debugging information to be logged to the Script Debugger’s Session Log without editing the server-side script being debugged.

Logpoints are session-specific. Setting a logpoint affects only the developer who created the logpoint.

24
Q

how are logpoints added

A

To set a logpoint, right-click in the gutter for the line of interest. Select the Add logpoint choice. If there is no Add logpoint choice, logpoints have not been enabled on the instance.

25
Q

what should be put in a logpoint

A

After setting a logpoint, write a server-side script specifying what to log. Use the gs.info() or gs.debug() methods. Logpoint scripts can end with a semicolon (;) but a semicolon is not required.

26
Q

Where can Logpoint messages be reviewed

A

Logpoints write to the JavaScript Debugger Session Log. To view logpoint messages, switch to the Session Log tab.

27
Q

What is the console debugger

A

The Script Debugger Console Debugger allows developers to evaluate script expressions in real time.

Enabled when the Script Debugger is paused at a breakpoint
Executes within the scope, context, and thread in which execution is paused
Writes evaluation results to the Console

28
Q

Script Includes are reusable server-side script logic that define a function or class. Script Includes execute their script logic only when explicitly called by other scripts. There are different types of Script Includes:

1._
2._
3._

A

Script Includes are reusable server-side script logic that define a function or class. Script Includes execute their script logic only when explicitly called by other scripts. There are different types of Script Includes:

On demand/classless
Extend an existing class
Define a new class

29
Q

What is an On Demand script include and what is unique about it

A

A Script Include that defines a single function is known as an on demand, or classless, Script Include. The function is callable from other server-side scripts. On demand Script Includes can never be used client-side even if the Client callable option is selected.

30
Q

What is a caveot with naming an on demand script include

A

The Script Include name must exactly match the name of the function within.

31
Q

The generalized Script Include script syntax for extending a class is:

A
32
Q

If the class being extended is from another scope, _ the class name with the scope.

A

If the class being extended is from another scope, prepend the class name with the scope. For example, if NameOfClassYouAreExtending is in the global scope, reference it as global.NameOfClassYouAreExtending in the scoped Script Include.

33
Q

The following is the client side script showing how to do a glide ajax call then parse and use the returned information

A
34
Q

Script include header for working with client side GlideAjax Call

A

Script include text for working with client side Glide Ajax Call

35
Q

For the script type: Business rule
1. Executes on
2. Description
3. Often used to

A
36
Q

For the script type: Script Include
1. Executes on
2. Description
3. Often used to

A
37
Q

For the script type: Script Action
1. Executes on
2. Description
3. Often used to

A
38
Q

For the script type: Schedueld Script Execution (also known as a Scheduled Job)
1. Executes on
2. Description
3. Often used to

A
39
Q

For the script type: UI Actions
1. Executes on
2. Description
3. Often used to

A
40
Q

For the script type: Scripts - Background
1. Executes on
2. Description
3. Often used to

A
41
Q

For the script type: Fix Scripts
1. Executes on
2. Description
3. Often used to

A
42
Q

For the script type: Notification Email Script
1. Executes on
2. Description
3. Often used to

A
43
Q

For the script type: Scripted REST APIs
1. Executes on
2. Description
3. Often used to

A
44
Q

For the script type: UI Page Processing Script
1. Executes on
2. Description
3. Often used to

A
45
Q

For the script type: Transform Map Script
1. Executes on
2. Description
3. Often used to

A