Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
**Client script Deatils**
1. Table: sys_script
2. Type: onSubmit
3. UI Type: Desktop

**Benefits**
1. This client script will prevent admin users to do insert/update operation in onBefore business rules.
2. It will help to avoid HealthScan findings thus increasing healthscan score.
3. Will prevent recursive calls.

Link to ServiceNow Business Rules best Practise : https://developer.servicenow.com/dev.do#!/guide/orlando/now-platform/tpb-guide/business_rules_technical_best_practices
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
function onSubmit() {
/*
This client script will prevent insert and update operation in onBefore business rules.
Table: sys_script
Type: onSubmit
Ui Type: Desktop
*/
var whenCond = g_form.getValue('when'); // when condition of business rule
var scriptVal = g_form.getValue('script'); // script value of business rule.

if (whenCond == 'before' && (scriptVal.indexOf('insert()') > -1 || scriptVal.indexOf('update()')) > -1) {
alert("As per ServiceNow best Practise insert and update should be avoided in onBefore BRs. If you still want tp proceed try deactivating client script : " + g_form.getUniqueValue());
return false;
}
}
Loading