Skip to content

Youth Profile Creation Tool

This workflow updates youth profile information in a PostgreSQL database when called by other workflows. It accepts basic profile data (ID, name, location, and business type) and updates the corresponding record in the youth_profiles table with a current timestamp.

Purpose

No business context provided yet — add a context.md to enrich this documentation.

How It Works

  1. Receive Profile Data: The workflow is triggered by another workflow that passes youth profile information including ID, name, location, and business type
  2. Update Database: The profile data is used to update the corresponding record in the youth_profiles table, matching by the youth ID
  3. Set Timestamp: The updated_at field is automatically set to the current timestamp when the update occurs

Workflow Diagram

graph TD
    A[When Executed by Another Workflow] --> B[Update rows in a table]

    A --> |youth_id, name, location, business_type| B
    B --> |Updated profile record| C[End]

Trigger

Execute Workflow Trigger: This workflow is designed to be called by other workflows, not run independently. It expects four input parameters: - youth_id: Unique identifier for the youth profile - name: Youth's name - location: Youth's location - business_type: Type of business the youth is involved in

Nodes Used

Node Type Node Name Purpose
Execute Workflow Trigger When Executed by Another Workflow Receives input parameters from calling workflows
PostgreSQL Update rows in a table Updates the youth profile record in the database

External Services & Credentials Required

PostgreSQL Database

  • Credential Name: "Postgres account 2"
  • Required Access: Read/write access to the youth_profiles table in the public schema
  • Database Schema: Must contain a youth_profiles table with columns: id, name, location, business_type, updated_at

Environment Variables

No environment variables are used in this workflow. All configuration is handled through n8n credentials and node parameters.

Data Flow

Input

The workflow expects these parameters from the calling workflow:

1
2
3
4
5
6
{
  "youth_id": "string (UUID)",
  "name": "string",
  "location": "string", 
  "business_type": "string"
}

Output

The workflow returns the result of the database update operation, typically including: - Number of rows affected - Updated record details - Database operation status

Database Operation

The workflow performs an UPDATE operation on the youth_profiles table: - Matching Column: id (matched against youth_id input) - Updated Fields: name, location, business_type, updated_at - Timestamp: updated_at is set to the current time using {{ $now }}

Error Handling

This workflow does not implement explicit error handling. Errors would be handled by: - Database Errors: PostgreSQL node will fail if the connection is unavailable or the query is invalid - Missing Data: The workflow may fail if required input parameters are not provided by the calling workflow - Record Not Found: If the youth_id doesn't exist in the database, the update operation will affect 0 rows but won't necessarily fail

Known Limitations

  • No validation of input data format or content
  • No error handling for database connection issues
  • No verification that the youth_id exists before attempting update
  • No logging or audit trail beyond the updated_at timestamp

This workflow is designed to be called by other workflows in the system. The calling workflows should handle: - Data validation before calling this workflow - Error handling if this workflow fails - Any business logic around when profile updates should occur

Setup Instructions

  1. Import Workflow: Import the workflow JSON into your n8n instance

  2. Configure PostgreSQL Credential:

    • Create a new PostgreSQL credential named "Postgres account 2"
    • Configure connection details for your database
    • Ensure the credential has read/write access to the youth_profiles table
  3. Verify Database Schema: Ensure your PostgreSQL database has a youth_profiles table with these columns:

    1
    2
    3
    4
    5
    6
    7
    CREATE TABLE youth_profiles (
      id VARCHAR PRIMARY KEY,
      name VARCHAR,
      location VARCHAR,
      business_type VARCHAR,
      updated_at TIMESTAMP
    );
    

  4. Test the Workflow:

    • Use the pinned test data or create a calling workflow
    • Verify that profile records are updated correctly
    • Check that the updated_at timestamp is set properly
  5. Integration: Configure other workflows to call this workflow using the "Execute Workflow" node, passing the required parameters