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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions Business Rules/Manipulating system properties values/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
**Business Rule**

Script which allows *getting value of specific system property and manipulate these values*. In this example, true/false property is got to determine if script should be executed. Then value of system property which is keeping last created user which gets 'admin' role is updated.

**Create new system property**

Before you can get or manipulate custom system property you need to create it in [sys_properties] table. Below you can see example of created property:

![Creating System Property](ScreenShot_0.PNG)

**Example configuration of Business Rule**

![Configuration](ScreenShot_1.PNG)

**Example execution effect**


![Execution effect](ScreenShot_2.PNG)
21 changes: 21 additions & 0 deletions Business Rules/Manipulating system properties values/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
(function executeRule(current, previous /*null when async*/ ) {
//Script to read and update specific system properties (in this example to update last created user name with role admin)

//Get value of property which you would like to verify
var updateAdminUser = gs.getProperty('user.updateNewAdminUsers');

//Verify if property is set to true
if (updateAdminUser) {

//Get property which you would like to update
var property = new GlideRecord('sys_properties');
property.addQuery('name', 'user.lastCreatedAdmin');
property.query();
if (property.next()) {

//Update value of choosed property
property.value = current.user.getDisplayValue();
property.update();
}
}
})(current, previous);