HR Leave · Australia

02 — Administration (Studio From Scratch)

Roles, Groups, Users, ACLs, all 9 system properties, Update Set promotion

Scopex_786686_hr_leave
sys_ide5f5bc9493a303507520703efaba104d
Instance labdev398980
URL token{BASE}
Quick open Visual map Roles ACLs Properties Groups

Visual map — Ch.02 · Administration — security

See in 10 seconds

Roles → Groups → Users → ACLs → 9 properties → Update Set

You build

employee · manager · hr_admin · integration

Track

Administration

ROLE4 roles
→
GRPGroups
→
USERLab users
→
ACLRead/Write
→
PROP9 keys
✓ Roles via groups✓ Test as non-admin✓ Explicit delete ACL✗ Test only as admin✗ Direct user→role✗ Properties client-side

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.

  1. Application picker — top-right globe / application menu → select HR Leave (x_786686_hr_leave). Never leave Global selected when creating scoped artifacts.
  2. Update Set — All → System Update Sets → Local Update Sets → New:
    FieldValue
    NameHR Leave – Build
    ApplicationHR Leave
    StateIn Progress
    DescriptionCaptures all HR Leave lab artifacts
    After submit: open the record → click Make Current. Direct list: {BASE}/sys_update_set_list.do
  3. 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

Form fields

FieldSuggested value
Namex_786686_hr_leave.employee
DescriptionSubmit and view own leave
Assignable byhr_admin

Repeat for three more roles:

NameDescriptionAssignable by
x_786686_hr_leave.employeeSubmit and view own leavehr_admin
x_786686_hr_leave.managerApprove team leavehr_admin
x_786686_hr_leave.hr_adminFull HR Leave adminadmin
x_786686_hr_leave.integrationREST / integration useradmin

Step-by-step create

  1. For each row: Studio → Role → New.
  2. Name = scoped role name. Description as table. Application = HR Leave.
  3. Submit. Repeat four times.

Verify checklist

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

Form fields

FieldSuggested value
NameHRLX Employees
Group Rolesx_786686_hr_leave.employee
Membersemployee1 (after Part 3)
Group nameGroup RolesMembers
HRLX Employeesx_786686_hr_leave.employeeemployee1
HRLX Managersx_786686_hr_leave.manager, employeemanager1
HRLX HR Adminsx_786686_hr_leave.hr_adminhradmin
HRLX Integrationx_786686_hr_leave.integration, rest_servicehrlx.integration

Step-by-step create

  1. Groups → New → Name from table.
  2. Related list Group Roles → Edit → add scoped roles.
  3. Related list Users → add members.
  4. Repeat for all four groups.

Verify checklist

Demo / test

Impersonate employee1 → roles include employee.


Part 3: Users (lab matrix)

Purpose

Four lab users for E2E testing.

Navigation path

Direct URL

Prerequisites

Form fields

FieldSuggested value
User IDemployee1
First name / Last nameLab Employee
Emailemployee1@lab.local
Activetrue
GroupHRLX Employees
User IDNameEmailGroup
employee1Lab Employeeemployee1@lab.localHRLX Employees
manager1Lab Managermanager1@lab.localHRLX Managers
hradminLab HR Adminhradmin@lab.localHRLX HR Admins
hrlx.integrationIntegration Bothrlx.integration@lab.localHRLX Integration

Step-by-step create

  1. Users → New for each row. Set password per instance policy.
  2. Active = true. Email required for notifications (chapter 06).
  3. Add to group via Groups related list.
  4. Seed employee_v2: employee1 user, manager = manager1, Employee ID E-1001.

Verify checklist

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

Form fields

ACL 1 — read

FieldSuggested value
Typerecord
Operationread
Namex_786686_hr_leave_req_v2
AdvancedChecked
Activetrue
ApplicationHR Leave
Scriptanswer = new x_786686_hr_leave.HRLXProSecurityUtilsV2().canReadLeave(current);

ACL 2 — write

FieldSuggested value
Operationwrite
Scriptanswer = new x_786686_hr_leave.HRLXProSecurityUtilsV2().canWriteLeave(current);

ACL 3 — create

FieldSuggested value
Operationcreate
Requires rolex_786686_hr_leave.employee
Scriptanswer = 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

FieldSuggested value
Namex_786686_hr_leave_req_v2.u_approver_user
Operationwrite
Scriptanswer = gs.hasRole('x_786686_hr_leave.hr_admin');

Step-by-step create

  1. Elevate security_admin. Application = HR Leave.
  2. ACL → New for each table above. Active = true.
  3. Paste scripts. Save all four.

Verify checklist

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

LabelNameTypeValueDescription
Annual Daysx_786686_hr_leave.config.annual_daysinteger20Default annual entitlement
Sick Daysx_786686_hr_leave.config.sick_daysinteger10Default sick entitlement
Notify Enabledx_786686_hr_leave.config.notify_enabledtrue|falsetrueMaster email switch
Min Notice Daysx_786686_hr_leave.config.min_notice_daysinteger3Min days before start
Max Days Per Requestx_786686_hr_leave.config.max_days_per_requestinteger30Max days per request
ERP Endpointx_786686_hr_leave.config.erp_endpointstringhttps://webhook.site/…Outbound ERP URL
Integration Userx_786686_hr_leave.config.integration_userstringhrlx.integrationInbound API user id
Number Prefixx_786686_hr_leave.config.number_prefixstringHRLXu_number prefix
Portal Page IDx_786686_hr_leave.config.portal_page_idstringhrlx_homeService Portal page id

On every property form: Application = HR Leave · Ignore cache = false · Private = false.

Step-by-step create

  1. Application picker = HR Leave.
  2. Open New property.
  3. Fill Label, Name, Type, Value, Description from one row → Submit.
  4. Repeat for all 9 rows.

Verify checklist

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

Form fields

FieldSuggested value
NameHR Leave – Build
StateComplete (when ready to export)
ApplicationHR Leave

Step-by-step create

  1. Complete local set — HR Leave – Build → State = Complete.
  2. Export — Retrieved Update Sets → Import from source OR XML export.
  3. Target instance — Import → Preview conflicts → Commit.
  4. Post-import — Recreate users/groups if not in set; verify 9 properties; run accrual job once.
  5. Smoke test — employee1 submit → manager1 approve → balance updated.

Never promote Global artifacts. Confirm Application = HR Leave on every captured file before export.

Verify checklist

Demo / test

Import to second PDI → smoke test E2E leave cycle.

Administration verify checklist

Complete after Parts 1–6 (Roles through Update Set promotion).

  1. Four scoped roles exist under HR Leave.
  2. Four groups with correct role assignments and lab users.
  3. Four lab users impersonate successfully; employee_v2 seeded.
  4. Four ACLs active; employee isolation verified.
  5. Nine system properties readable via gs.getProperty.
  6. Update Set Complete and ready for export.