Visual map — Ch.02 · Administration — security
Roles → Groups → Users → ACLs → 9 properties → Update Set
employee · manager · hr_admin · integration
Administration
Full visual path (all chapters): VISUAL_FROM_SCRATCH_00_16.html
Studio-only from scratch: Security and configuration in ServiceNow UI. Requires 01 Development tables and Script Includes first.
Also open: Properties + Direct Links · Schema · Studio Create All Objects · Previous: 01 Development
How administration objects relate
01 Development (tables, Script Includes, BR)
│
▼
Part 1 Roles (4 scoped roles)
│
▼
Part 2 Groups (grant roles to lab users)
│
▼
Part 3 Users (employee1, manager1, hradmin, integration)
│
├──────────────────┐
▼ ▼
Part 4 ACLs Part 5 System Properties (9 config keys)
(read/write/create (annual_days, notify, ERP endpoint…)
on req_v2 via SI)
│
▼
Part 6 Update Set promotion (export to target)
Security flow: User → Group → Role → ACL script (HRLXProSecurityUtilsV2) → req_v2 access. Properties drive accrual job, notifications, portal page id.
Rule 0 — Before any object (Application + Update Set + Studio)
Repeat these checks before creating or editing any application file. This section is also section 00 Update Set — create the capture set first.
- Application picker — top-right globe / application menu → select HR Leave (
x_786686_hr_leave). Never leave Global selected when creating scoped artifacts. - Update Set — All → System Update Sets → Local Update Sets → New:
After submit: open the record → click Make Current. Direct list: {BASE}/sys_update_set_list.doField Value Name HR Leave – BuildApplication HR Leave State In Progress Description Captures all HR Leave lab artifacts - Open Studio — {BASE}/$studio.do → confirm header shows HR Leave.
If artifacts land in Global scope, delete them and recreate under HR Leave. ACLs and events created globally will not behave correctly for this app.
Verify Update Set: Create a test Script Include in Studio → open HR Leave – Build → Related List Customer Updates shows the new file.
Part 1: Roles
Purpose
Defines four scoped roles for employee self-service, manager approval, HR admin, and integration REST access.
Navigation path
Direct URL
Prerequisites
- Part 1: Application Setup (01 Development).
- Rule 0 Update Set current.
Form fields
| Field | Suggested value |
|---|---|
| Name | x_786686_hr_leave.employee |
| Description | Submit and view own leave |
| Assignable by | hr_admin |
Repeat for three more roles:
| Name | Description | Assignable by |
|---|---|---|
x_786686_hr_leave.employee | Submit and view own leave | hr_admin |
x_786686_hr_leave.manager | Approve team leave | hr_admin |
x_786686_hr_leave.hr_admin | Full HR Leave admin | admin |
x_786686_hr_leave.integration | REST / integration user | admin |
Step-by-step create
- For each row: Studio → Role → New.
- Name = scoped role name. Description as table. Application = HR Leave.
- Submit. Repeat four times.
Verify checklist
- Four roles filtered by x_786686_hr_leave.
Demo / test
Assign employee role via group in Part 2 → user inherits role after login.
Part 2: Groups
Purpose
Assignment groups that grant scoped roles to lab users.
Navigation path
Direct URL
Prerequisites
- Part 1: Roles exist.
Form fields
| Field | Suggested value |
|---|---|
| Name | HRLX Employees |
| Group Roles | x_786686_hr_leave.employee |
| Members | employee1 (after Part 3) |
| Group name | Group Roles | Members |
|---|---|---|
| HRLX Employees | x_786686_hr_leave.employee | employee1 |
| HRLX Managers | x_786686_hr_leave.manager, employee | manager1 |
| HRLX HR Admins | x_786686_hr_leave.hr_admin | hradmin |
| HRLX Integration | x_786686_hr_leave.integration, rest_service | hrlx.integration |
Step-by-step create
- Groups → New → Name from table.
- Related list Group Roles → Edit → add scoped roles.
- Related list Users → add members.
- Repeat for all four groups.
Verify checklist
- User record → Roles related list shows inherited group roles.
Demo / test
Impersonate employee1 → roles include employee.
Part 3: Users (lab matrix)
Purpose
Four lab users for E2E testing.
Navigation path
Direct URL
Prerequisites
- Part 2: Groups ready.
Form fields
| Field | Suggested value |
|---|---|
| User ID | employee1 |
| First name / Last name | Lab Employee |
| employee1@lab.local | |
| Active | true |
| Group | HRLX Employees |
| User ID | Name | Group | |
|---|---|---|---|
| employee1 | Lab Employee | employee1@lab.local | HRLX Employees |
| manager1 | Lab Manager | manager1@lab.local | HRLX Managers |
| hradmin | Lab HR Admin | hradmin@lab.local | HRLX HR Admins |
| hrlx.integration | Integration Bot | hrlx.integration@lab.local | HRLX Integration |
Step-by-step create
- Users → New for each row. Set password per instance policy.
- Active = true. Email required for notifications (chapter 06).
- Add to group via Groups related list.
- Seed employee_v2: employee1 user, manager = manager1, Employee ID E-1001.
Verify checklist
- Impersonate each user successfully.
- employee_v2 links employee1 → manager1.
Demo / test
employee1 creates req_v2 → u_approver_user = manager1 after save (BR1).
Part 4: ACLs
Purpose
Record and field ACLs enforce who can read, write, and create leave requests using HRLXProSecurityUtilsV2.
Navigation path
Direct URL
Prerequisites
- Part 7: HRLXProSecurityUtilsV2 (01).
- Part 1: Roles.
- Elevate security_admin.
Form fields
ACL 1 — read
| Field | Suggested value |
|---|---|
| Type | record |
| Operation | read |
| Name | x_786686_hr_leave_req_v2 |
| Advanced | Checked |
| Active | true |
| Application | HR Leave |
| Script | answer = new x_786686_hr_leave.HRLXProSecurityUtilsV2().canReadLeave(current); |
ACL 2 — write
| Field | Suggested value |
|---|---|
| Operation | write |
| Script | answer = new x_786686_hr_leave.HRLXProSecurityUtilsV2().canWriteLeave(current); |
ACL 3 — create
| Field | Suggested value |
|---|---|
| Operation | create |
| Requires role | x_786686_hr_leave.employee |
| Script | answer = gs.hasRole('x_786686_hr_leave.employee') || gs.hasRole('x_786686_hr_leave.hr_admin') || gs.hasRole('x_786686_hr_leave.integration'); |
ACL 4 — field write u_approver_user
| Field | Suggested value |
|---|---|
| Name | x_786686_hr_leave_req_v2.u_approver_user |
| Operation | write |
| Script | answer = gs.hasRole('x_786686_hr_leave.hr_admin'); |
Step-by-step create
- Elevate security_admin. Application = HR Leave.
- ACL → New for each table above. Active = true.
- Paste scripts. Save all four.
Verify checklist
- employee1 sees own requests only.
- manager1 sees direct reports.
- hradmin sees all.
- employee1 direct URL to another user's record → denied.
Demo / test
Impersonate employee1 → open coworker sys_id → Access denied.
Part 5: System Properties
Purpose
Scoped configuration — create all 9 properties from the professional catalog.
Navigation path
Direct URL
Prerequisites
Form fields — create each row
| Label | Name | Type | Value | Description |
|---|---|---|---|---|
| Annual Days | x_786686_hr_leave.config.annual_days | integer | 20 | Default annual entitlement |
| Sick Days | x_786686_hr_leave.config.sick_days | integer | 10 | Default sick entitlement |
| Notify Enabled | x_786686_hr_leave.config.notify_enabled | true|false | true | Master email switch |
| Min Notice Days | x_786686_hr_leave.config.min_notice_days | integer | 3 | Min days before start |
| Max Days Per Request | x_786686_hr_leave.config.max_days_per_request | integer | 30 | Max days per request |
| ERP Endpoint | x_786686_hr_leave.config.erp_endpoint | string | https://webhook.site/… | Outbound ERP URL |
| Integration User | x_786686_hr_leave.config.integration_user | string | hrlx.integration | Inbound API user id |
| Number Prefix | x_786686_hr_leave.config.number_prefix | string | HRLX | u_number prefix |
| Portal Page ID | x_786686_hr_leave.config.portal_page_id | string | hrlx_home | Service Portal page id |
On every property form: Application = HR Leave · Ignore cache = false · Private = false.
Step-by-step create
- Application picker = HR Leave.
- Open New property.
- Fill Label, Name, Type, Value, Description from one row → Submit.
- Repeat for all 9 rows.
Verify checklist
- Background:
gs.info(gs.getProperty('x_786686_hr_leave.config.annual_days'));→ 20. - Nine properties visible in scoped list.
Demo / test
Run accrual job (chapter 06) → new balances use annual_days.
Part 6: Update Set Promotion
Purpose
Complete and export HR Leave – Build for target instance promotion.
Navigation path
Direct URL
Prerequisites
- All Parts 1–5 captured in HR Leave – Build.
- Rule 0 Update Set was current during creates.
Form fields
| Field | Suggested value |
|---|---|
| Name | HR Leave – Build |
| State | Complete (when ready to export) |
| Application | HR Leave |
Step-by-step create
- Complete local set — HR Leave – Build → State = Complete.
- Export — Retrieved Update Sets → Import from source OR XML export.
- Target instance — Import → Preview conflicts → Commit.
- Post-import — Recreate users/groups if not in set; verify 9 properties; run accrual job once.
- Smoke test — employee1 submit → manager1 approve → balance updated.
Never promote Global artifacts. Confirm Application = HR Leave on every captured file before export.
Verify checklist
- Customer Updates lists roles, ACLs, properties.
- No Global-scope rows in set.
Demo / test
Import to second PDI → smoke test E2E leave cycle.
Administration verify checklist
Complete after Parts 1–6 (Roles through Update Set promotion).
- Four scoped roles exist under HR Leave.
- Four groups with correct role assignments and lab users.
- Four lab users impersonate successfully; employee_v2 seeded.
- Four ACLs active; employee isolation verified.
- Nine system properties readable via gs.getProperty.
- Update Set Complete and ready for export.