How to prevent a record insert in ServiceNow

You can make a field mandatory via its dictionary definition, but this still allows for scripted / server-side inserts.

To prevent even those programmatic record inserts, you can use the setAbortAction() (opens in a new tab) method on the GlideRecord object in a before business rule.

// Inside a before business rule
 
(function executeRule(current, previous /*null when async*/) {
	current.setAbortAction(true);
})(current, previous);