> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# CreateTask

> Create a task from documents in one batch with the CreateTask method of the ABBYY FlexiCapture Web Services API, setting stage, priority, owner, and queue.

## What it does

Creates a task from the set of documents of one batch.

## Definition

```
int CreateTask( int sessionId, int batchId, int stageExternalId, int priority, string comment, int UserId, int[] docIds, bool setAsCurrentTask );
```

## Parameters

<table width="100%"><tbody><tr><td><p><strong>Name</strong></p></td><td><p><strong>Type</strong></p></td><td><p><strong>Description</strong></p></td></tr><tr><td><p>sessionId</p></td><td><p>int</p></td><td><p>The ID of the connection to the Application Server</p></td></tr><tr><td><p>batchId</p></td><td><p>int</p></td><td><p>The ID of the batch that contains the document about which information is to be retrieved</p></td></tr><tr><td><p>stageExternalId</p></td><td><p>int</p></td><td><p>The ID of the stage the task will be placed in</p></td></tr><tr><td><p>priority</p></td><td><p>int</p></td><td><p>The priority of the task. See <a href="/flexi-capture/api/structures/t-priority">Priority</a> for possible values.</p></td></tr><tr><td><p>comment</p></td><td><p>string</p></td><td><p>A text comment to the task</p></td></tr><tr><td><p>userId</p></td><td><p>int</p></td><td><p>The ID of the user the task will be assigned to. If the group ID is specified, the task can be processed by any user of the group. If the value is "0" the task can be processed by any user who is allowed to process this queue in the given batch type. For queues processed by the Processing Server, this parameter is ignored.</p></td></tr><tr><td><p>docIds</p></td><td><p>int\[]</p></td><td><p>The IDs of the batch documents</p></td></tr><tr><td><p>setAsCurrentTask</p></td><td><p>bool</p></td><td><p>The flag that shows whether the task will be set as a current task or will be placed in a queue. Possible values:</p><ul><li><strong>True</strong> - the task will be set as a current task for the user who called the method;</li><li><strong>False</strong> - the task will be placed in a queue.</li></ul></td></tr></tbody></table>

## Returned value

| **Type** | **Description** |
| -------- | --------------- |
| int      | Task ID         |
