📖
Rulecube documentation
v2.0
v2.0
  • Overview
  • Quick Start
  • Tutorial
    • Getting started
    • Create and Run Your First Ruleset
    • Use Constants and Methods
    • Create and Call Functions
    • Adding Testcases
    • Using Lookup Tables
    • Using Entities
  • How-to Guides
    • Logging in and Authorization
      • Activate Your Account From an Invitation
      • Log in to Rulecube
      • Change Your Password
      • Recover Your Password
      • Two-factor authentication (2FA)
      • Invite Other Users to Rulecube
      • Edit a User's Role
      • Delete a User
    • Ruleset Development
      • Create a Ruleset
      • Set the Input for a Ruleset
      • Create a Rule
      • Generate Alerts
      • Try out a Ruleset
      • Call a Ruleset from Your Software
      • Entities
        • Create an Entity
        • Drag and Drop a JSON Schema or XSD to create entities
        • Advanced topic: Entity instantiation
      • Constants
        • Constant Tables
      • Functions
      • Built-in Functions
      • Create and Run a Testcase
      • Delete a Ruleset or Components
      • Debugging your Ruleset
    • Create a Workflow
      • Workflow step types
      • Working with documents in a workflow
    • Work with (Environment) Variables
    • Call a Ruleset via Its API From Postman
    • Creating input from JSON Schema
    • Use a Ruleset from Your Software
    • Ruleset Productivity Tips
  • Language Reference
    • Global
    • Finance
    • Http
    • Mail
    • MongoDB
    • SQL
    • Statistics
    • Workflow
    • System
    • Array
    • Date
Powered by GitBook
On this page
  1. How-to Guides
  2. Create a Workflow

Working with documents in a workflow

Rulecube contains some specialized methods that you can use within a workflow to handle uploaded or generated workflow documents.

Workflow.getDocuments()

Get all documents from the database that are related to the current workflow.

Returns a list of WorkflowDocument.

Workflow.getDocument(documentTypeName)

Get a document from the database with the given documentTypeName.

The documentTypeName parameter should match one of the document types defined in the workflow Settings.

Returns a WorkflowDocument.

Workflow.getDocumentDataUri(documentTypeName)

Get a document from the database as a data URI.

The documentTypeName parameter should match one of the document types defined in the workflow Settings.

Returns a string.

Workflow.saveDocument(documentTypeName, dataUri, fileName?)

Save a document to the database. This is useful for when you want your application to generate a document and store it.

The documentTypeName parameter should match one of the document types defined in the workflow Settings.

The dataUri parameter is the Base64 data URI of the document.

The fileName parameter is optional and defines the name of the file.

Returns void.

// This assumes there is a Document Type defined in the workflow with the name 'MyDocument'.' 
Workflow.saveDocument('MyDocument', 'data:text/plain;base64,SG93ZHkgcGFydG5lciE=');  

// The 3rd parameter is optional and can be used to set the file name. 
Workflow.saveDocument('MyDocument', 'data:text/plain;base64,SG93ZHkgcGFydG5lciE=', 'MyFile.txt'); 

PreviousWorkflow step typesNextWork with (Environment) Variables

Last updated 1 year ago