workflow-triggering
Start AEM Workflows on AEM as a Cloud Service using all available triggering mechanisms. Use when starting workflows manually via the Timeline UI, programmatically via WorkflowSession.startWorkflow(), via the HTTP Workflow API, through Manage Publication, or passing initial metadata and payload to a workflow instance.
- License 许可
- Apache-2.0
- 所属仓库
- kalash33/kstack
- 最近更新
- 2026-05-20
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- workflow-triggering
- license
- Apache-2.0
- description
- Start AEM Workflows on AEM as a Cloud Service using all available triggering mechanisms. Use when starting workflows manually via the Timeline UI, programmatically via WorkflowSession.startWorkflow(), via the HTTP Workflow API, through Manage Publication, or passing initial metadata and payload to a workflow instance.
02 资源文件 8
- 参考文档references/workflow-foundation/api-reference.md3.5 KB
- 参考文档references/workflow-foundation/architecture-overview.md2.3 KB
- 参考文档references/workflow-foundation/cloud-service-guardrails.md2.7 KB
- 参考文档references/workflow-foundation/jcr-paths-reference.md2.4 KB
- 参考文档references/workflow-foundation/quick-start-guide.md2.0 KB
- 参考文档references/workflow-foundation/README.md826 B
- 参考文档references/workflow-triggering/programmatic-api.md5.2 KB
- 参考文档references/workflow-triggering/triggering-mechanisms.md4.6 KB
03 SKILL.md 正文
Workflow Triggering (Cloud Service)
All mechanisms to start a workflow on AEM Cloud Service — from UI, programmatic API, HTTP API, and Manage Publication.
Variant Scope
- AEM Cloud Service only.
- Use service users with
workflow-process-servicesub-service mapping for programmatic triggering.
Triggering Mechanisms Summary
| Mechanism | Use Case |
|---|---|
| Timeline UI | One-off manual start on a single page or asset |
| Manage Publication | Multi-page batch start, integrates with publish pipeline |
| WorkflowSession API | Backend Java code, scheduled jobs, event handlers |
| HTTP Workflow API | REST calls, scripts, external integrations |
| Workflow Launchers | Automatic on JCR events — see workflow-launchers skill |
1. Manual via Timeline UI
- Navigate to a page or asset in Sites/Assets console
- Open Timeline panel (clock icon)
- Click Start Workflow
- Select the model from the dropdown
- Optionally enter a workflow title and comment
- Click Start
The workflow starts with the selected item as JCR_PATH payload and the current user as initiator.
2. Manage Publication (Multi-Page)
- Sites Console → select pages → Manage Publication
- Choose action (Publish / Unpublish)
- Check Include Workflow
- Select workflow model
- Click Publish Later or Publish Now
AEM creates a cq:WorkflowContentPackage containing all selected pages as the workflow payload.
3. Programmatic (WorkflowSession API)
@Component(service = MyWorkflowService.class)
public class MyWorkflowService {
@Reference
private ResourceResolverFactory resolverFactory;
public String startWorkflow(String payloadPath, String modelId,
Map<String, Object> initialMeta) throws Exception {
Map<String, Object> auth = Collections.singletonMap(
ResourceResolverFactory.SUBSERVICE, "workflow-process");
try (ResourceResolver resolver = resolverFactory.getServiceResourceResolver(auth)) {
WorkflowSession wfSession = resolver.adaptTo(WorkflowSession.class);
WorkflowModel model = wfSession.getModel(modelId);
WorkflowData data = wfSession.newWorkflowData("JCR_PATH", payloadPath);
// Set initial metadata
MetaDataMap meta = data.getMetaDataMap();
if (initialMeta != null) {
initialMeta.forEach(meta::put);
}
Workflow instance = wfSession.startWorkflow(model, data);
return instance.getId();
}
}
}
Model ID format: /var/workflow/models/my-workflow (the runtime path, not the design-time path)
4. HTTP Workflow API
# Start a workflow
curl -u admin:admin -X POST \
"http://localhost:4502/api/workflow/instances" \
-d "model=/var/workflow/models/my-workflow" \
-d "payloadType=JCR_PATH" \
-d "payload=/content/my-site/en/home" \
-d "workflowTitle=Review Request from CI"
# Response: 201 Created with Location header pointing to instance path
# Get workflow instance details
curl -u admin:admin \
"http://localhost:4502/api/workflow/instances/<instanceId>.json"
# List running instances
curl -u admin:admin \
"http://localhost:4502/api/workflow/instances?state=RUNNING&model=/var/workflow/models/my-workflow"
Guardrails
- Always specify a
workflowTitlewhen starting programmatically — it helps operators identify instances in the console. - Never start workflows with admin credentials from production code. Use a service user.
- Model ID must be the
/var/workflow/models/path (runtime). Do not use the/confdesign-time path. - Check that the model is synced to
/var/workflow/models/before callingstartWorkflow().
References
- triggering-mechanisms.md — detailed guide for each mechanism
- programmatic-api.md — WorkflowSession API patterns and service user setup
- api-reference.md
- jcr-paths-reference.md
- cloud-service-guardrails.md
04 同仓库更多 Skills
zustand-store-ts
Create Zustand stores with TypeScript, subscribeWithSelector middleware, and proper state/action separation. Use when building React state management, creating global stores, or implementing reacti...
zoom-automation
Automate Zoom meeting creation, management, recordings, webinars, and participant tracking via Rube MCP (Composio). Always search tools first for current schemas.
zoho-crm-automation
Automate Zoho CRM tasks via Rube MCP (Composio): create/update records, search contacts, manage leads, and convert leads. Always search tools first for current schemas.
zod-validation-expert
Expert in Zod — TypeScript-first schema validation. Covers parsing, custom errors, refinements, type inference, and integration with React Hook Form, Next.js, and tRPC.
zeroize-audit
Detects missing zeroization of sensitive data in source code and identifies zeroization removed by compiler optimizations, with assembly-level analysis, and control-flow verification. Use for auditing C/C++/Rust code handling secrets, keys, passwords, or other sensitive data.
zendesk-automation
Automate Zendesk tasks via Rube MCP (Composio): tickets, users, organizations, replies. Always search tools first for current schemas.