Skip to content

Instantly share code, notes, and snippets.

@Elrashid
Last active July 26, 2025 18:10
Show Gist options
  • Select an option

  • Save Elrashid/41975223aa003731a5ed2b9aa20385be to your computer and use it in GitHub Desktop.

Select an option

Save Elrashid/41975223aa003731a5ed2b9aa20385be to your computer and use it in GitHub Desktop.
{
"id": "vacation-v1",
"name": "Vacation Request",
"version": 1,
"root": {
"type": "Elsa.Flowchart",
"activities": [
{ "id": "start", "type": "Elsa.HttpEndpoint", "path": "/api/leave", "methods": ["POST"] },
{ "id": "capture", "type": "Elsa.SetVariable", "variable": "LeaveRequest", "value": "{{HttpContext.Request.Body}}" },
{ "id": "mgr", "type": "Elsa.RunWorkflow", "workflowDefinitionId": "manager-approval" },
{ "id": "decision", "type": "Elsa.Decision", "expression": "{{mgr.Output.Status}}" },
{ "id": "rejectNotify", "type": "Elsa.SendEmail", "to": "{{LeaveRequest.EmployeeEmail}}", "subject": "Leave rejected" },
{ "id": "hr", "type": "Elsa.RunWorkflow", "workflowDefinitionId": "hr-approval" },
{ "id": "sql", "type": "Elsa.ExecuteSql", "connectionString": "HRDB", "sql": "EXEC BookLeave @EmpId, @Start, @End" },
{ "id": "notify", "type": "Elsa.SendEmail", "to": "{{LeaveRequest.EmployeeEmail}}", "subject": "Leave approved" },
{ "id": "done", "type": "Elsa.WriteHttpResponse", "statusCode": 201 }
],
"connections": [
{ "sourceActivityId": "start", "targetActivityId": "capture" },
{ "sourceActivityId": "capture", "targetActivityId": "mgr" },
{ "sourceActivityId": "mgr", "targetActivityId": "decision" },
{ "sourceActivityId": "decision", "targetActivityId": "rejectNotify", "outcome": "Rejected" },
{ "sourceActivityId": "decision", "targetActivityId": "hr", "outcome": "Approved" },
{ "sourceActivityId": "hr", "targetActivityId": "sql" },
{ "sourceActivityId": "sql", "targetActivityId": "notify" },
{ "sourceActivityId": "notify", "targetActivityId": "done" }
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment