Performance and Security Flashcards
What should we do with mission critical User Event scripts if we want to account for any errors or misfires?
Create a “clean up” scheduled script to make sure user events performed as they should have.
True or False?
User Event scripts can trigger other user event scripts.
False
UE scripts cannot trigger other UE scripts
What should we do with common code that is used across multiple User Event scripts?
Create a custom module, or a “library”, that contains that common code.
True or False?
It is should NOT read sensitive field values from a User Event script
True.
As a best practice, how can we limit the scope of a User Event from within the script itself?
We can use the context object, and context.UserEventType enum to define a limit the scope of a UE script
When should we use the afterSubmit entry point in a User Event script?
When using an operation that depends on the submitted record already being committed to the database
When updating transaction line items in a beforeSubmit script we must ensure that the line item totals, net taxes and discounts are equal to what 4 fields?
summarytotal
discounttotal
shippingtotal
taxtotal
Why is creating many UE scripts for a single record discouraged?
It greatly increases load times and hinders user experience
To set a field on a record or make any changes to a record being submitted, which entry point should we use?
beforeSubmit
Any post-processing operations of a current record should be done in what user event?
afterSubmit
If you want to store a value during a beforeLoad operation and then read that value during an afterSubmit operation in the same script, as a best practice, what should you do?
Create a hidden custom field on the form to store the value. Value stored in beforeLoad in this field and then the value is retrieved from this field in afterSubmit
What does the execution context setting on a User Event specify?
How and when a UE is triggered. (e.g., Only trigger from UI, Only trigger from Suitelet, etc…)
Limit the amount of script execution in UE scripts. Time taken to execute should be less than..?
5 seconds
What should we use to test performance of user event scripts deployed to a specific record type?
The Script Performance Monitor SuiteApp
What should we use for debugging a User Event?
The debugger; statements on the browser console
This statement can also be used in the SuiteScript Debugger to help debug server scripts
True or False?
Activities on a hosted website can trigger server-side scripts
True
Scripts on Sales Order, Case, and Customer records also execute in response to web activities.
True or False?
We should use inline editable child custom records when processing child records during UE on a parent record
True
What 4 things can we do to optimise search filters?
◦ Filter inactive records
◦ Shorter date range
◦ Faster operators (e.g. starts with, between, and within are faster than contains or formulas)
◦ Remove unnecessary columns
Why should we try to combine searches of the same record type by using merged filters where possible?
This improves performance by reducing search instances
How many results does N/search return?
N/search returns the first 1000 results
If we want N/search to return more results, what can we do, and what is the limit?
Can return a resultSet, but the limit is 4000 results
Alternatively, can use pagination for N/search to return more than 1000 results
When returning a large dataset with N/search:
If a record that originally fit the search criteria is updated and no longer fits the criteria, what happens?
It is skipped by the search.
In this case, some records that were originally included in the search results may not be returned, and the total number of returned records may be smaller than the original total number of results.
When returning a large dataset with N/search:
If new records are created that fit the search criteria, what happens?
They are also returned.
The total number of returned records may be higher after you page through the results than the original total number of results, and duplicate results may be returned.
When returning a large dataset with N/search:
If a record from the first results page is updated and it no longer fits the criteria when going through subsequent pages of search results, what could be a concern?
Results may be missing.
For example, if a record from the first results page is updated and it no longer fits the criteria, another record now fits into page one. However, because earlier pages are skipped when going through subsequent pages of search results, this record is not returned.
True or False?
When returning a large dataset with N/search:
Page two and the subsequent pages of the results set may contain fewer records than the specified page size.
True
If new records of the same type, matching the search criteria, are created between a search request and a searchMoreWithId request, what problem could occur?
It can cause position changes in the results and can move records on or even out of search pages. This causes missing or duplicate records on pages.
To avoid issues when returning a large dataset with N/search:
How should we define our search criteria, to avoid using a loosely defined search that returns a large data set, and why?
Make your search criteria as specific as possible.
With more specific criteria, the result set is smaller and there is less chance that records fitting the search criteria are created or updated as you go through the pages of the result set.
To avoid issues when returning a large dataset with N/search:
To ensure new or updated records will not fit the search criteria or to ensure that no new records are added or updated during your search, what would be the best solution?
Using a within lastModifedDate filter is the best solution
In SuiteScript 2.0, as an alternative to using the N/search module for large data sets, what module can we use instead, and which object members of that module?
N/task
searchTask object
searchTaskStatus object
To avoid issues when returning a large dataset with N/search:
If your search contains a search join, you can lower the occurrence of issues with duplicate results how?
By setting two Sort By columns.
True or False?
N/query can use multilevel joins.
True
N/query can convert query objects into what other type of query?
SuiteQL queries
What is SuiteQL?
SuiteQL is a query language based on the SQL-92 revision of the SQL database query language
True or False?
N/query can load, delete and save existing queries.
False
N/query can load and delete existing queries, but it can NOT save queries
True or False?
N/query uses a different data source than the N/search module
True
Record type ID or field ID (e.g. Actual Shipping Date field ID in N/search is actualshipdate, but in N/query it is actualShipDate)
What format are the results from N/query returned in, and what is the limit?
They are returned as a result set, with a maximum of 5000 results