Skip to main content

Script

The Script component can be included within a function model to execute TypeScript code directly. It provides several built-in functions that allow you to control the workflow.

Files Upload to S3

flow.context.file.upload(fileBody: string | Blob | Uint8Array, fileName: string, fileLabel: string, action: IActionData);
  • The upload method uploads the specified file to S3 and adds it to the processInstance.files section of the process.
  • Must be used with "await"
  • Must be used within workflow context.
  • fileBody parameter accepts : base64-encoded string Uint8Array (from an S3 donwload etc.) Blob
  • action parameter is flexible can be anything that conforms IActionData.

Files Delete From S3

flow.context.file.delete(storageHandle: string, action: IActionData);
  • The delete method removes the specified file from S3 and also deletes it from processInstance.files.
  • Must be used with "await"
  • Must be used within workflow context.
  • action parameter is flexible can be anything that conforms IActionData.
  • assignToUser and assignToSwimlane API Methods
    The existing assignToUser and assignToSwimlane API methods are now available within the script task enabling assigned user and swimlane information to be managed directly through scripts.
assignToUser(taskId: string, targetUserId: string): Promise<{ isSuccess: boolean }>;
assignToSwimlane(taskId: string, swimlane: string): Promise<{ isSuccess: boolean }>;