CSA-C01 study materials
CSA-C01 study resources

CSA-C01: Business Rules, Script Includes, and Client Scripts

CSA-C01 · Work through your exam, one topic at a time.

All guide sections

Business Rules, Script Includes, and Client Scripts

Server-side logic lives in business rules (run on insert, update, delete, query, or on display) and script includes (reusable JavaScript classes/functions). Client scripts run in the browser. Candidates must know the business rule execution order: before rules run before the database write; after rules run after; async rules run in the background. Order values determine sequence among rules of the same type.

Script includes are called from business rules, UI actions, or other script includes. They can be client-callable (via GlideAjax) if they extend AbstractAjaxProcessor. Know the GlideRecord API: addQuery, query, next, get, insert, update, delete, and setValue. Understand GlideSystem (gs) methods like gs.getUser(), gs.log(), and gs.addInfoMessage().

Traps: assuming a before rule can read the record's new sys_id (it cannot - the record is not yet inserted; use before for setting values, after for actions requiring the sys_id). Assuming client scripts can query the database directly (they cannot). And confusing async rules with synchronous behavior - async rules do not block the transaction.

Worked example: To stamp a field before insert, use a before insert business rule: current.setValue('u_stamp', new GlideDateTime().getDisplayValue());. To send a notification after insert (needing the sys_id), use an after insert rule or a notification. To call server logic from a client script, create a client-callable script include and invoke it with GlideAjax.