Place a validation rule where every write needs it
Choose the execution context and timing for a validation that affects forms and integrations.
Place a validation rule where every write needs it
Work through the decision
A form makes a justification mandatory when a request becomes urgent. A supported integration updates the same table with no form open. Why could the form behavior alone leave invalid records?
Check your reasoning
UI policies control supported form behavior, such as visibility and mandatory or read-only states. Client scripts respond to client events. Enforce a cross-channel data requirement with an applicable server-side control, such as a data policy for a field requirement or a before business rule for appropriate logic. Test the form and the integration path.
Compare the choices
- UI policy
- Apply conditional form behavior declaratively, including making fields visible, read-only or mandatory on the supported form.
- Client script
- Run JavaScript for supported form or list events in the client. Use an appropriate client API and verify behavior on the target interface.
- Before business rule
- Run appropriate server-side logic before a database operation is persisted. Keep the operation, condition and execution timing explicit.
- After business rule
- Run server-side logic after a database operation, for example to update a related record when appropriate. Keep side effects bounded and avoid recursive writes.
Choose the execution point
A before rule can set a derived field on the current record before persistence. An after rule can coordinate a related-record update when the source has been written. Async work may run later and is unsuitable if a caller must see a synchronous result. A display rule runs when preparing a record for display.
Practice the guide skills
- Make a supported form field conditionally mandatory or visible with a UI policy. Check the behavior through the actual form and a separate integration path. Watch 2:39:58
- Choose before, after, async or display timing for a server-side business rule. Check that its condition and operations limit its scope. Watch 2:45:46
- Match a client form interaction to JavaScript and g_form, and a server record operation to supported server APIs such as GlideRecord. Test with appropriate roles in a lower instance. Watch 2:47:57
Official objectives for this lesson
Related lesson · Apply repository policy and triage alerts
Place a validation rule where every write needs it quiz
Answer 3 questions. Check each answer for an explanation.