Skip to main content

Input/Output Parameters and Actions

Input/Output parameters allow you to process and transform data before and after task execution in your process workflows. This powerful feature supports three types of operations: Scripts, Expressions, and Actions.

Overview

Input/Output parameters are available for:

  • User Tasks (Manual Tasks)
  • Send Tasks (Email Tasks)
  • Sub Processes

Parameter Types

TypeDescriptionUse Case
ScriptJavaScript code executed server-sideComplex logic, calculations, API calls
ExpressionString ValueVariable with a static string value
ActionVisual function builderUI operations, database queries, file handling

Input Parameters

Input parameters are executed before the task runs, allowing you to:

  • Transform external data for task consumption
  • Set up task-specific variables
  • Prepare data from previous tasks
  • Initialize default values

Example Input Scenarios:

  • Format user data before sending an email
  • Calculate values for a user interface
  • Prepare API request parameters
  • Set up database queries

Output Parameters

Output parameters are executed after the task completes, allowing you to:

  • Process task results
  • Transform data for the next steps
  • Update process variables
  • Save results to databases

Example Output Scenarios:

  • Process form submission data
  • Format API responses
  • Calculate performance metrics
  • Update external systems

Script Parameters

Scripts use JavaScript and run in a secure server-side environment with access to the Softyflow SDK.

Basic Script Example:

// Calculate total price with tax
let subtotal = orderItems.reduce((sum, item) => sum + (item.price * item.quantity), 0);
let tax = subtotal * 0.08;
let total = subtotal + tax;

return {
subtotal: subtotal,
tax: tax,
total: total
};

Available Variables in Scripts:

  • Process Variables: All current process variables
  • SF_initiator: Process initiator information
  • SF_latestValidator: Latest task validator
  • volt: Global configuration variables
  • SF: Softyflow SDK instance

SDK Functions Available:

// Database operations
SF.collection.find('users', {status: 'active'})
SF.collection.insertOne('orders', orderData)

// File operations
SF.file.upload(fileData)
SF.file.download(fileId)

// User operations
SF.user.getUserById(userId)
SF.user.updateUserMetadata(userId, 'preference', value)

// Process operations
SF.instance.launchProcess(processId, variables)
SF.instance.validateTask(taskId, data)

Expression Parameters

Expressions are simple text expressions.

Expression Examples:

// Simple variable assignment
"Status Done"

Action Parameters

Actions provide a visual interface for building complex functions without writing code.

Available Action Categories:

Database Actions

  • Find Collection: Query database collections
  • Insert to Collection: Add new documents
  • Update Collection: Modify existing documents
  • Delete Document: Remove documents
  • Aggregate Collection: Complex database queries
  • SQL Operations: Direct SQL database operations

Process Actions

  • Launch Process: Start new process instances
  • Validate Task: Complete pending tasks
  • Get Pending Task: Retrieve task information
  • Update Instance Variables: Modify process data
  • Get Measures: Retrieve process metrics

User Management Actions

  • Find Users: Search user database
  • Find User By ID: Get specific user
  • Update User Metadata: Modify user preferences
  • Get User Metadata: Retrieve user data

Utility Actions

  • Get Next Value: Generate sequential numbers
  • Call API: External API integration
  • Generate PDF: Create PDF documents
  • Send Email: Email notifications

Action Configuration Example:

{
"id": "generate_invoice",
"name": "Generate Invoice",
"type": "process",
"returnValue": "invoice_data",
"actions": [
{
"call": "_findCollection",
"params": [
{"name": "Collection", "type": "collection-ref", "value": "orders"},
{"name": "Criteria", "type": "json-query", "value": "{\"_id\": \"{{ orderId }}\"}"}
]
},
{
"call": "_getNextValue",
"params": [
{"name": "Label", "type": "input-string", "value": "\"INVOICE\""},
{"name": "Padding", "type": "input-string", "value": "6"}
]
}
]
}

Configuration Interface

Adding Parameters

  1. Open Task Configuration: Select any task in the process modeler
  2. Access Input/Output Section: Scroll to the Input/Output section
  3. Add Parameters: Use the + buttons to add new parameters:
    • Add Script: For JavaScript code
    • Add Expression: For simple expressions
    • Add Action: For visual function building

Parameter Management

Drag & Drop Ordering

Parameters execute in order from top to bottom. Use the drag handle to reorder:

📋 Parameter 1 (executes first)
📋 Parameter 2 (executes second)
📋 Parameter 3 (executes last)

Variable Propagation

Enable "Apply to all branches" to share variables across parallel process branches.

Testing Parameters

Use the built-in testing interface to:

  • Add test variables with sample data
  • Execute parameters in isolation
  • View results and debug issues
  • Validate logic before deployment

Best Practices

Performance Optimization

  • Use expressions for simple operations
  • Use scripts for complex logic
  • Use actions for database operations
  • Minimize external API calls in critical paths

Error Handling

// Robust script example
try {
let result = complexCalculation(inputData);
return result;
} catch (error) {
console.error('Calculation failed:', error);
return defaultValue;
}

Variable Naming

  • Use descriptive names: customerEmail vs email
  • Follow naming conventions: camelCase
  • Avoid system prefixes: Don't start with SF_

Advanced Features

Dynamic Variable Names

// Set variables dynamically
let variableName = 'user_' + userId;
variables[variableName] = userData;

Conditional Execution

// Only execute if conditions are met
if (orderTotal > 1000) {
return applyDiscountLogic();
}
return orderTotal;

Multi-Instance Processing

For sub-processes with parallel instances:

// Access loop variables in sub-process
let currentItem = SF_loop_variables;
let itemIndex = SF_loop_index;

System Variables

Always available in scripts and expressions:

  • SF_initiator: Process starter information
  • SF_latestValidator: Last task validator
  • SF_mode: Current execution mode (test/prod)
  • SF_version: Process version
  • instanceId: Current process instance ID
  • projectId: Current project ID

Examples

Email Template Data Preparation

// Input Script for Send Task
return {
customerName: SF_initiator.firstName + ' ' + SF_initiator.lastName,
orderDate: new Date().toLocaleDateString(),
orderItems: cart.items,
totalAmount: cart.total.toFixed(2),
supportEmail: 'support@company.com'
};

User Task Assignment

// Expression for dynamic user assignment
department === 'finance' ? 'finance-team@company.com' : 'general-team@company.com'

Data Validation Output

// Output Script after User Task
let errors = [];
if (!email.includes('@')) errors.push('Invalid email');
if (age < 18) errors.push('Must be 18 or older');

return {
isValid: errors.length === 0,
errors: errors,
processedData: {
email: email.toLowerCase(),
age: parseInt(age),
registeredAt: new Date()
}
};

Service Integration Action

Action to update external CRM system:

  1. Find Collection: Get customer data
  2. Call API: Send data to CRM
  3. Update Collection: Mark as synchronized
  4. Return: Synchronization status

Troubleshooting

Common Issues

Variable Not Found

Error: Cannot read property 'name' of undefined

Solution: Check variable names and ensure they exist in the process context.

Syntax Errors in Scripts

Error: Unexpected token

Solution: Validate JavaScript syntax and use the testing interface.

Action Parameter Errors

Error: Missing required parameter

Solution: Ensure all required action parameters are configured correctly.

Timeout Errors

Error: Operation timed out

Solution: Optimize scripts and actions, consider breaking into smaller operations.

Debugging Tips

  1. Use Console Logging: Add console.log() statements in scripts
  2. Test Incrementally: Start with simple expressions and build complexity
  3. Check Variable Values: Use the variable finder to verify available data
  4. Validate Data Types: Ensure variables contain expected data types
  5. Use Try-Catch: Wrap complex operations in error handling

This comprehensive input/output system provides powerful data transformation capabilities while maintaining simplicity for common use cases. Whether you need simple variable mapping or complex business logic, the combination of scripts, expressions, and actions covers all process automation needs.