Flow Designer · Practical Lab

Practical Flow Designer — From Scratch

Build automation you can see: pick the right tool (Flow vs BR vs Fluent), run the HR Leave approval lab, then a VR vulnerable-item remediation flow — with direct URLs and SDK boundaries.

Tablesx_786686_hr_leave_req_v2 · sn_vul_vulnerable_item
UIFlow Designer / Workflow Studio
SDKFlow() · transform
Time~60–90 min
Open these first Flow Designer Flows list Approvals Workflow Studio Leave requests Vulnerable Items

How to use this page

Read the dark flow boards left→right · follow stepboard labs · click url-box links · treat green/red chips as go-live gates.

1Choose tool
→
2Create Flow
→
3Trigger
→
4Actions
→
5Logic
→
6Activate
→
7Test

§1 — When to use Flow Designer vs Business Rule vs Fluent Flow()

At a glance — pick one primary tool

Business Rule

Same-transaction field defaults, sync validation, thin “set value before insert”. Keep short. No multi-step approvals.

Flow Designer (UI)

Approvals, multi-step, spokes, notifications, wait conditions, visible to process owners. First choice for new automation.

Fluent Flow()

Same WFA artefact as code for CI/CD. Build in UI first if complex, then transform — or author Fluent when team owns SDK.

Use Business Rule when…

  • Must run in the same DB transaction
  • Set u_approver_user before save (HR Leave BR1)
  • Abort invalid insert with current.setAbortAction(true)

Use Flow Designer when…

  • Ask for Approval / wait for answer
  • Create Change + notify + update VI
  • IntegrationHub spoke actions
  • Non-developers must read the process

Use Fluent Flow() when…

  • App is already SDK-first
  • You need reproducible install across instances
  • You transform UI flows into source of truth
✓ BR for sync field math · Flow for process ✓ One owner per process (avoid BR + Flow both updating state) ✗ Long Glide loops inside BR that should be Flow + For Each ✗ Duplicate approval logic in Script Include and Flow

§2 — Direct URLs & Filter Navigator

WhatFilter / pathURL
Flow DesignerProcess Automation → Flow Designer{BASE}/now/flow-designer
Flows listProcess Automation → Flows{BASE}/sys_hub_flow_list.do
SubflowsProcess Automation → Subflows{BASE}/…type=subflow
ActionsProcess Automation → Actions{BASE}/sys_hub_action_type_definition_list.do
ApprovalsMy Approvals{BASE}/sysapproval_approver_list.do
Workflow StudioWorkflow Studio (playbooks / modern PA){BASE}/now/workflow-studio
Flow contextsFlow execution history{BASE}/sys_flow_context_list.do
SpokesIntegrationHub → Spokes{BASE}/sys_hub_spoke_list.do

§3 — Triggers (what starts the flow)

Record CreatedNew row only · use when process starts at insert
Record UpdatedField change · HR Leave: state → submitted
Record Created or UpdatedBroader · tighten with condition
ScheduledDaily VI SLA chase · accrual jobs prefer Scheduled Script if simple
Service CatalogAfter catalog submit · variables as inputs
Inbound EmailParse subject/body · create / update ticket

HR Leave rule: requests are often created as draft then updated to submitted — use Record Updated with condition u_state = submitted (and previous ≠ submitted if available).

VR rule: VI can be created by import in bulk — prefer Updated when priority/state crosses a threshold, or Created with assignment empty, so you do not double-fire.

§4 — Core actions you will use constantly

ActionUse forLab tip
Ask for ApprovalManager / risk owner gateRules: Anyone approves · Approver = field reference
Create RecordChange, task, notification logMap VI → CHG short description
Update RecordSet state approved / assignedNever fight a BR updating the same field
Send NotificationEmail / workplace alertOr fire event + Notification record
Look Up RecordsFind open VIs / manager / CIFeed For Each
LogDebug without gs.info in BRKeep in lab; strip noise for prod

§5 — Flow logic (If / For Each / Error)

IFApproved?
→
THENUpdate state
→
ELSEReject path
Look Upopen VIs
→
For EachVI
→
Createtask

§6 — Lab A: HR Leave approval (from scratch)

A0Prereq: table x_786686_hr_leave_req_v2, fields u_state, u_approver_user, BR1 fills approver
A1Open Flow Designer → Create Flow → Name HRLX Leave Approval · App HR Leave
A2Trigger: Record Updated · Table leave req · Condition u_state is submitted
A3Action: Ask for Approval · Approver = Trigger → Approver field · Anyone approves
A4If Approved → Update Record u_state = approved
A5Else → Update Record u_state = rejected
A6Save → Activate → test as employee + manager
Flow Designer · HRLX Leave Approvalsys_hub_flow
Trigger
Approval
If
Update
TriggerUpdated · req_v2 · u_state=submitted
Ask Approvalu_approver_user · Anyone
If Approvedu_state → approved
Elseu_state → rejected
Screen — canvas order must match A2→A5. BR3 (audit/balance) reacts after state update.
# Proof after activate
# 1. Impersonate employee → create leave → set submitted
# 2. Open {BASE}/sysapproval_approver_list.do as manager → Approve
# 3. Confirm req u_state = approved
# 4. Flow context: {BASE}/sys_flow_context_list.do (state COMPLETE)
✓ Activate only after Save shows no red errors ✓ Test with impersonation ✗ Trigger on Created only if draft→submit pattern exists ✗ Leave flow inactive “for later” in shared PDI

§7 — Lab B: VR Vulnerable Item → remediation Change

Companion to Practical SecOps + VRO. Goal: when a high/critical VI is created (or priority rises), notify assignee and optionally create a Change.

VIpriority 1–2
→
Look UpCI owner
→
Updateassign
→
Notify
→
CreateCHG
B0Plugin VR available · sample VI on VI list
B1Create Flow VR VI High Priority Triage (scoped app or global — prefer scoped wrapper app)
B2Trigger: Record Created or Updated · sn_vul_vulnerable_item · priority IN 1,2 · state open
B3If assigned_to empty → Update Record from CI support group / owner
B4Send Notification or Log + work note
B5(Optional) Create Record change_request linked to VI / CI
B6Activate on sub-prod first · watch contexts during scanner import

Import storm: scanner imports can create thousands of VIs. Add conditions (priority, business service critical) and prefer assignment rules in VR for bulk routing; use Flow for exceptions and Change creation policy.

Flow Designer · VR VI High Priority Triagesn_vul_vulnerable_item
Trigger
If
Update
Notify
CHG
TriggerVI · priority 1/2 · open
Ifassigned_to EMPTY
Updateassign from CI owner
Createchange_request (optional)
Screen — keep first release read-notify-assign; add Create Change only after Lab B0 proves data quality.

§8 — Canvas orientation (what you should see)

§9 — Best practices (Do / Don't)

✓ Name flows with app prefix (HRLX / VR) ✓ Tight trigger conditions before Activate ✓ One writer of each state field ✓ Test with impersonation + flow context ✓ Prefer Subflow for repeated blocks ✗ gs.print debugging left in production actions ✗ Flow + BR both flipping the same state ✗ Unbounded For Each on full VI table ✗ Activate on prod without sub-prod soak

§10 — SDK side: what Flow() can and cannot do

CAN: Define Workflow Automation flows in Fluent (Flow() / WFA APIs); ship with build + install; activate on install unless --skip-flow-activation; pull UI-built flows with npx @servicenow/sdk transform --table sys_hub_flow --auth DEV; author subflows and reusable actions where APIs exist; study offline with npx @servicenow/sdk explain flow-api and explain wfa-flow-guide.

CANNOT: Replace Flow Designer’s live data-pill picker / design-time UX; debug mid-canvas with live record pills from the CLI; own every playbook / experience-only activity via Fluent; assume install merges gently — it deploys your app package (coordinate so you do not wipe teammates’ unpublished UI-only edits). Runtime VI/user data is not in the Fluent package.

# Windows PowerShell — after UI flow is stable
cd C:\SVCProject\HR_Leave_App\servicenow-ai-workspace\hr-leave-sdk
npx @servicenow/sdk explain flow-api
npx @servicenow/sdk explain wfa-flow-guide
npx @servicenow/sdk transform --table sys_hub_flow --auth DEV
npx @servicenow/sdk build
npx @servicenow/sdk install --auth DEV
# Optional: do not auto-activate flows
# npx @servicenow/sdk install --auth DEV --skip-flow-activation
TopicSDK?Notes
WFA Flow / SubflowYESFlow() or UI + transform
Ask for Approval stepYESPrefer UI first for pill wiring
Design-time picker UXNOPlatform UI only
Playbook-only activitiesLIMITEDWorkflow Studio / playbook topics
Spoke credential secretsNOInstance Credential store

Full Windows install → auth → all commands → can/cannot matrix: SDK_WINDOWS_FULL_CYCLE_CAN_CANNOT.html. Flag bible: SDK_CURSOR_FULL_DOCUMENTATION.html.

§11 — Related docs

{BASE}/now/flow-designer {BASE}/sys_hub_flow_list.do {BASE}/sysapproval_approver_list.do {BASE}/sys_flow_context_list.do