Skip to content

Commit a357cb8

Browse files
Update script.js
1 parent 970549f commit a357cb8

File tree

1 file changed

+7
-7
lines changed
  • Server-Side Components/Business Rules/GRC Policy Retirement Gaurd

1 file changed

+7
-7
lines changed

Server-Side Components/Business Rules/GRC Policy Retirement Gaurd/script.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(function executeRule(current, previous /*null when async*/ ) {
22
// This Business Rule runs 'before' a record is updated on the 'sn_compliance_policy' table.
3-
// Its purpose is to prevent a policy from being retired if it is currently linked to any active controls.
4-
// This enforces a proper decommissioning process, ensuring that controls are retired
3+
// Its purpose is to prevent a policy from being retired if it is currently linked to any active Control Objective.
4+
// This enforces a proper decommissioning process, ensuring that Control Objective are delinked.
55
// before the policy that governs them, thereby preventing compliance gaps.
66
// The condition for this rule would be: 'State' changes to 'Retired'.
77

@@ -18,7 +18,7 @@
1818

1919
// Add a second query using 'dot-walking' to filter for records where the related
2020
// control statement ('content' field) is currently active. This ensures only active
21-
// controls are considered.
21+
// Control Objective are considered.
2222
grControlAggregate.addQuery('content.active', true);
2323

2424
// Set the aggregate function to COUNT. This tells the database to return the total
@@ -28,7 +28,7 @@
2828
// Execute the database query.
2929
grControlAggregate.query();
3030

31-
// Initialize a variable to store the count of active controls.
31+
// Initialize a variable to store the count of active Control Objective.
3232
var activeControlCount = 0;
3333

3434
// Check if the query returned any results. If it did, retrieve the count.
@@ -38,11 +38,11 @@
3838
activeControlCount = grControlAggregate.getAggregate('COUNT');
3939
}
4040

41-
// Check if the count of active controls is greater than zero.
41+
// Check if the count of active Control Objective is greater than zero.
4242
if (activeControlCount > 0) {
43-
// If active controls were found, add an error message to display to the user.
43+
// If active Control Objective were found, add an error message to display to the user.
4444
// The message includes the count for better clarity.
45-
gs.addErrorMessage('Cannot retire this policy because it has ' + activeControlCount + ' active controls linked to it. All controls must be retired first.');
45+
gs.addErrorMessage('Cannot retire this policy because it has ' + activeControlCount + ' active Control Objective linked to it. All Control Objective must be delinked first.');
4646

4747
// This crucial line aborts the current database transaction (the update operation).
4848
// It prevents the policy record from being marked as 'Retired'.

0 commit comments

Comments
 (0)