You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|**target**|`string`|conditional| URL, Script Name, Flow ID, Modal/Page Name, or API Endpoint. **Required** for `url`, `flow`, `modal`, and `api` types; recommended for `script`.|
41
+
|**execute**|`string`| optional |⚠️ **Deprecated** — Use `target` instead. Auto-migrated to `target` during parsing. Will be removed in a future version.|
42
42
|**params**|`Object[]`| optional | Input parameters required from user |
The `target` field is the canonical way to bind an action to its handler:
57
+
58
+
| Action Type | target | Description |
59
+
| :--- | :--- | :--- |
60
+
|`script`| Recommended | Function name to invoke (e.g. `completeTask`) |
61
+
|`url`|**Required**| URL to navigate to |
62
+
|`flow`|**Required**| Flow name to invoke (validated against defined flows) |
63
+
|`modal`|**Required**| Page/modal name to open (validated against defined pages) |
64
+
|`api`|**Required**| API endpoint to call |
65
+
66
+
### Examples
67
+
68
+
```typescript
69
+
// Script action with handler target
70
+
const action:Action= {
71
+
name: 'complete_task',
72
+
label: 'Mark Complete',
73
+
type: 'script',
74
+
target: 'completeTask', // ← references a registered handler function
75
+
locations: ['record_header'],
76
+
refreshAfter: true,
77
+
};
78
+
79
+
// Flow action
80
+
const flowAction:Action= {
81
+
name: 'convert_lead',
82
+
label: 'Convert Lead',
83
+
type: 'flow',
84
+
target: 'lead_conversion', // ← must match a defined flow name
85
+
};
86
+
87
+
// Modal action
88
+
const modalAction:Action= {
89
+
name: 'defer_task',
90
+
label: 'Defer Task',
91
+
type: 'modal',
92
+
target: 'defer_task_modal', // ← must match a defined page name
93
+
};
94
+
```
95
+
96
+
<Callouttype="warn">
97
+
**Migration Note:** The `execute` field is deprecated. If `execute` is provided without `target`, it is automatically migrated to `target` during schema parsing. Always use `target` in new code.
98
+
</Callout>
54
99
55
100
---
56
101
@@ -69,3 +114,25 @@ const result = Action.parse(data);
69
114
70
115
---
71
116
117
+
## Cross-Reference Validation
118
+
119
+
`defineStack()` validates action cross-references at build time:
120
+
121
+
-**`type: 'flow'`** — `target` is checked against the `flows[]` collection (when flows are defined).
122
+
-**`type: 'modal'`** — `target` is checked against the `pages[]` collection (when pages are defined).
123
+
124
+
When the target collection is empty, validation is skipped because referenced items may come from plugins.
0 commit comments