§1 — When to use Flow Designer vs Business Rule vs Fluent Flow()
At a glance — pick one primary tool
Same-transaction field defaults, sync validation, thin “set value before insert”. Keep short. No multi-step approvals.
Approvals, multi-step, spokes, notifications, wait conditions, visible to process owners. First choice for new automation.
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_userbefore 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
§2 — Direct URLs & Filter Navigator
| What | Filter / path | URL |
|---|---|---|
| Flow Designer | Process Automation → Flow Designer | {BASE}/now/flow-designer |
| Flows list | Process Automation → Flows | {BASE}/sys_hub_flow_list.do |
| Subflows | Process Automation → Subflows | {BASE}/…type=subflow |
| Actions | Process Automation → Actions | {BASE}/sys_hub_action_type_definition_list.do |
| Approvals | My Approvals | {BASE}/sysapproval_approver_list.do |
| Workflow Studio | Workflow Studio (playbooks / modern PA) | {BASE}/now/workflow-studio |
| Flow contexts | Flow execution history | {BASE}/sys_flow_context_list.do |
| Spokes | IntegrationHub → Spokes | {BASE}/sys_hub_spoke_list.do |
§3 — Triggers (what starts the flow)
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
| Action | Use for | Lab tip |
|---|---|---|
| Ask for Approval | Manager / risk owner gate | Rules: Anyone approves · Approver = field reference |
| Create Record | Change, task, notification log | Map VI → CHG short description |
| Update Record | Set state approved / assigned | Never fight a BR updating the same field |
| Send Notification | Email / workplace alert | Or fire event + Notification record |
| Look Up Records | Find open VIs / manager / CI | Feed For Each |
| Log | Debug without gs.info in BR | Keep in lab; strip noise for prod |
§5 — Flow logic (If / For Each / Error)
- If / Else — branch on approval outcome, priority, empty fields.
- For Each — iterate Look Up results; cap batch size for import storms.
- Try / Error handler (where available) — catch spoke failures; set work note; do not leave VI half-updated silently.
- Wait for condition — pause until field changes (rescan verified).
§6 — Lab A: HR Leave approval (from scratch)
x_786686_hr_leave_req_v2, fields u_state, u_approver_user, BR1 fills approverHRLX Leave Approval · App HR Leaveu_state is submittedu_state = approvedu_state = rejected# 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)§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.
VR VI High Priority Triage (scoped app or global — prefer scoped wrapper app)sn_vul_vulnerable_item · priority IN 1,2 · state openchange_request linked to VI / CIImport 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.
§8 — Canvas orientation (what you should see)
Left rail
Trigger · Actions · Flow Logic · Data
Open →Center
Ordered steps · drag reorder
Open →Right / pills
Data pills from trigger & prior steps
Open →Runtime
Contexts · errors · waiting
Open →§9 — Best practices (Do / Don't)
§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| Topic | SDK? | Notes |
|---|---|---|
| WFA Flow / Subflow | YES | Flow() or UI + transform |
| Ask for Approval step | YES | Prefer UI first for pill wiring |
| Design-time picker UX | NO | Platform UI only |
| Playbook-only activities | LIMITED | Workflow Studio / playbook topics |
| Spoke credential secrets | NO | Instance 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
Chapter 09
Leave approval walkthrough
Open →Approval flow detail
Step-by-step Arabic/EN
Open →SecOps + VRO
VI lifecycle + Flow hooks
Open →Practical AI
Agents + Control Tower
Open →SDK Windows cycle
Install · deploy · can/cannot
Open →SDK flag reference
All 12 commands
Open →