Skip to content

Pre-fill Forms from URL Parameters

Load user context and pre-populate forms when they open

Launch workflows (also called startup workflows) run when a form loads to fetch data and make it available throughout the form. Use them to pre-fill fields, check permissions, or load context.

A customer feedback form that:

  • Loads customer details from URL parameter
  • Pre-fills customer name and email
  • Shows personalized welcome message

Create a workflow that accepts a parameter and returns data (workspace/workflows/load_customer.py):

from bifrost import workflow, param, ExecutionContext
@workflow(name="load_customer_data", description="Load customer for feedback form")
@param("customer_id", type="string", required=True)
async def load_customer_data(context: ExecutionContext, customer_id: str):
"""Load customer data for pre-filling form."""
# Fetch customer from database
customer = await get_customer(context, customer_id)
return {
"customer_name": customer.name,
"customer_email": customer.email,
"purchase_date": customer.last_purchase_date,
"product_name": customer.last_product
}
  1. Open form in builder
  2. Right panel → Launch Workflow section
  3. Select load_customer_data

To pass customer_id via URL:

  1. Add form field: customer_id (hidden text field)
  2. Enable Allow as Query Parameter on the field
  3. Save form

Now you can use: /execute/form?customer_id=cust-123

Show workflow data using HTML Content fields:

<div className="p-4 bg-blue-50 rounded-lg border border-blue-200">
<h2 className="font-bold text-lg">
Welcome back, {context.workflow.customer_name}!
</h2>
<p className="text-sm text-gray-700">
We see you purchased {context.workflow.product_name} on{" "}
{context.workflow.purchase_date}. We'd love to hear your feedback!
</p>
</div>

Show fields based on workflow data:

// Show VIP feedback field only for premium customers
context.workflow.customer_tier === "premium";
@workflow(name="check_permissions")
async def check_permissions(context: ExecutionContext):
"""Check if user can access form."""
return {
"is_admin": context.is_platform_admin,
"user_email": context.email,
"can_approve": await has_permission(context, "approve_requests")
}

Use in form visibility rules to show admin-only fields.

@workflow(name="load_org_context")
async def load_org_context(context: ExecutionContext):
"""Load organization details."""
org = await get_organization(context, context.org_id)
return {
"org_name": org.name,
"org_plan": org.subscription_plan,
"org_features": org.enabled_features
}

Use to display org info or control feature availability.

@workflow(name="load_ticket_data")
@param("ticket_id", type="string", required=True)
async def load_ticket_data(context: ExecutionContext, ticket_id: str):
"""Load ticket details for follow-up form."""
ticket = await fetch_ticket_from_psa(context, ticket_id)
return {
"ticket_number": ticket.number,
"customer_name": ticket.customer,
"issue_description": ticket.description,
"priority": ticket.priority
}

Pre-fill form with existing ticket details for follow-up.

Provide default values when URL params aren’t provided:

  1. In form settings → Default Launch Parameters
  2. Enter JSON:
{
"include_history": true,
"limit": 10
}

These are used when parameters aren’t in the URL.

Test launch workflow before using in form:

  1. Click Play button next to Launch Workflow in form builder
  2. Enter test parameters
  3. Click Execute
  4. View returned data
  5. Verify all expected fields are present

Form won’t load: Launch workflow has required parameters but no default values or URL params provided. Add defaults or pass via URL.

Data not appearing: Click Info button in form builder to see context.workflow object. Verify workflow returns expected fields.

Workflow fails: Check workflow logs for errors. Verify parameters are correct type and external APIs are accessible.

Parameters not working: Ensure form field with same name exists and has “Allow as Query Parameter” enabled.

  1. Keep workflows fast - They block form load. Avoid slow API calls or heavy processing.
  2. Return only needed data - Don’t fetch entire objects if you only need a few fields.
  3. Handle missing data - Return sensible defaults if external system returns null.
  4. Use caching - Cache expensive lookups to speed up repeated form loads.
  5. Test independently - Test launch workflow with Play button before using in form.
@workflow(name="load_survey_context")
@param("customer_id", type="string", required=True)
async def load_survey_context(context: ExecutionContext, customer_id: str):
"""Load customer context for satisfaction survey."""
customer = await get_customer(context, customer_id)
return {
"customer_name": customer.name,
"customer_email": customer.email,
"last_purchase": customer.last_purchase_date,
"product_name": customer.last_product_name,
"is_premium": customer.tier == "premium"
}