Skip to content
MyAppBuilder
StableGuide

Create a job after a quote is approved

Goal: when a quote's status becomes Approved , create the customer (if your quotes store contact details) and then create a Job linked to that customer, copying the quote's details.

Create a job after a quote is approved

Goal: when a quote's status becomes Approved, create the customer (if your quotes store contact details) and then create a Job linked to that customer, copying the quote's details.

This example shows how one step's result feeds the next: the created customer's id is used in the job's Customer field.

Data needed

  • Quotes with Number, Description, Amount, Customer Name, Customer Email and a Status select field including Approved.
  • Customers with Name and Email.
  • Jobs with Title, Description, Status and a Customer relation field pointing to Customers (field key customer). The Job Manager and Customers business components create these entities with such a relation.

Step-by-step configuration

  1. Logic → Workflows → New workflow → When status changes to X → create record. - When a record of: Quotes · Status field: Status · Changes to: Approved · Then create a record in: Jobs. - Name it Quote approved → create job and click Create workflow. The trigger is set to A record is updated, Only when Status changes, Only if Status is "Approved", and a Create job Database step is pre-filled with matching fields (its result is saved as created).
  2. Click + right after the trigger (before Create job) and add a Database step: - Operation: Create record · Entity: Customers. - Field values: Name = {{record.customer_name}}, Email = {{record.customer_email}}. - Save result as: customer. Rename the step Create customer.
  3. Click the Create job step and set its field values: - Title = Job for quote {{record.number}} - Description = {{record.description}} - Customer = Action results › customer.id (in a template: {{results.customer.id}}) - Status = the first job stage, for example Scheduled.
  4. Optionally add a Send email step to the customer: To = {{record.customer_email}}, subject Your job is scheduled.
  5. Keep the workflow On and run Test run with an approved test quote.
Example
WHEN  a quote is updated · Status changes · Status is "Approved"
  1. Create customer   Customers  Name={{record.customer_name}}  Email={{record.customer_email}}   → customer
  2. Create job        Jobs       Title="Job for quote {{record.number}}"  Customer={{results.customer.id}}
  3. Send email        To={{record.customer_email}}  "Your job is scheduled"

Resulting behaviour

  • Moving a quote to Approved (from the Quote Approval buttons, a Kanban board or the data editor) creates one Customer and one Job linked to it.
  • Run history shows three steps; step 1's output is { "id": "rec_…" }, and step 2 references that id.
  • Database steps inside workflows run with system privileges, so the job is created even if the person who approved the quote (a customer) has no permission to create jobs.

Variations

  • Reuse an existing customer instead of creating one: if your quote already has a Customer relation, skip step 2 and set Job › Customer = {{record.customer}}.
  • Find rather than create: use a Database step with Find records (Customers where Email = {{record.customer_email}}, result key customers) followed by If / else on {{results.customers_count}} being 0.
  • Copy the amount: add a Quoted Amount currency field on Jobs and set it to {{record.amount}}.
  • Avoid duplicates on re-approval: the trigger fires only when Status changes to Approved, so toggling Approved → Sent → Approved creates a second job. Add a Job Created yes/no field on Quotes, set it to true in a fourth Database step (Update record, current record), and add Only if Job Created is not true to the trigger.

Common mistakes

  • Typing {{results.customer}} (the whole record) into a relation field. Relation fields need the id: {{results.customer.id}}.
  • A result key with a dash or space (created-customer). Keys allow letters, numbers and underscores.
  • Required fields on Jobs left empty: the step fails with a validation message in Run history.

Related

Was this helpful?