Overview
Code tasks support direct placeholders inside the code editor. You no longer need separate "input field mapping" for most code-task scenarios. Add placeholders where values are needed and FlowFn resolves them at runtime.
Placeholder syntax
{{$trigger.<fieldKey>}}– value from trigger inputs.{{$task.<taskId>.outputs.<fieldKey>}}– value from a previous task output.
Examples:
const email = {{$trigger.email}};
const customerId = {{$task.fetchCustomer.outputs.customer_id}};
const amount = {{$task.calculate.outputs.total_amount}};
Using custom values in code
You can mix literal constants and placeholders in your code:
const payload = {
team: "sales",
threshold: 100,
userEmail: {{$trigger.email}},
summary: {{$task.summarize.outputs.text}}
};
For string interpolation, keep placeholders in JavaScript expression positions (not inside quoted strings):
const message = `Hello ${{$trigger.first_name}}!`;
Type behavior
FlowFn resolves placeholders with type-aware casting so values are preserved when possible (number, boolean, date/datetime/time, json/model, array). File fields resolve to the full file object (artifact pointer or URL metadata) unless you use a dotted subpath: .url is a presigned read URL when the file is in S3 (for example {{$task.<id>.outputs.my_file.url}}); other common fields include .key, .bucket, .region, .filename (artifact metadata), and for inline buffers .contentType or .name, depending on how the file was produced.
Best practices
- Reference outputs only from tasks that run earlier in execution order.
- Use clear output keys in upstream tasks so placeholders remain readable.
- Test with a manual run after changing placeholders.
- If a value may be missing, guard it in code (for example with default fallback logic).
Troubleshooting
- If a placeholder resolves empty, check the task ID/key and verify the upstream task produced that output.
- If runtime behavior looks different than expected, inspect run details and output payloads for each step.