Here is the Business Rule script template:This type of JavaScript function is known as:
Business Rules scripts use the server-side APIs to take actions. Those actions could be, but are not limited to:
https://developer.servicenow.com/dev.do#!/learn/learning-plans/xanadu/new_to_servicenow/app_store_learnv2_scripting_xanadu_business_rule_scripts