Skip to main content
In Stratumn, a workflow is defined as an object that groups together its name, the organization it belongs to, its members, and its core configuration.

Workflow Example

Here is a high-level view of what a workflow definition looks like:
export const myWorkflow: BetterWorkflowDef = {
  name: '🗺️ My Process',
  id: 'my-workflow-id',
  description: 'A brief description of the process',
  account: myOrganization,
  config: {
    // Core workflow logic
    pdfTemplate: {
      // PDF and document templates configuration
    },
    actions: {
      // List of available actions
    },
    initState: {
      // Initial data of the trace
    },
    initActions: {
      // Actions available at the start for each group
    },
    // ... other configuration properties
  },
  groups: {
    // User groups involved in the workflow
  },
  members: {
    // Members associated with the workflow
  }
};

PDF & Document Templates

The pdfTemplate section in the config object is where you define templates used for generating documents like PDF, DOCX, PPTX, or Excel files. Each template is identified by a unique key and contains the following properties:
file
string
required
The path to the template file (e.g., src/assets/pdfTemplate/example.pdf).
availableFields
object[]
required
A list of fields that can be filled in the template.

Configuration Example

config: {
  pdfTemplate: {
    // A simple PDF template example
    invoiceTemplate: {
      file: 'src/assets/pdfTemplate/invoice.pdf',
      availableFields: [
        {
          type: 'text',
          fieldName: 'Customer Name',
          mandatory: true
        },
        {
          type: 'text',
          fieldName: 'Amount',
          mandatory: true
        }
      ]
    },
    // A complex PPTX template for candidate presentations
    candidatePresentation: {
      file: 'src/assets/pdfTemplate/presentation_template.pptx',
      availableFields: [
        {
          type: 'text',
          fieldName: 'candidateName',
          mandatory: true
        }
      ]
    }
  },
  // ... rest of the config
}
These templates can then be used in your effects using the generatePdf external function.