Documentation

bizproc.task.complete

This method completes workflow tasks. Presently, the tasks Document approval and Document review can be executed. Only your own task can be completed, as well as the task, not completed yet.

Starting from the Business Process module version 20.0.800 you have an option to execute Request for extra information. You can execute only your task and only when it wasn't executed yet.

Parameters

Parameter Description Note Available from version
TASK_ID Task ID, required.
STATUS Target task status, required..
List of accessible values:
  • 1 or yes - "Yes" response (approved)
  • 2 or no - "No" response (rejected)
  • 3 or ok - "Ok" response (reviewed)
  • 4 or cancel - "Cancellation" response (presently is not used)
Statuses:
1 and 2 for Document Approval action;
3 and 4 for Request for extra information action;
3 for Request for extra information (can be declined) action.
COMMENT User comment, task parameters govern whether it is required or not.

Example

function completeTask(id, status, comment, cb)
    {
        var params = {
            TASK_ID: id,
            STATUS: status,
            COMMENT: comment
        };

        BX24.callMethod(
            'bizproc.task.complete',
            params,
            function(result)
            {
                if(result.error())
                    alert("Error: " + result.error());
                else if (cb)
                    cb();
            }
        );
    }

Executing Request for extra information via REST

Starting from the Business Process module version 20.0.800 you have an option to execute Request for extra information via rest method bizrpoc.task.complete.

To understand which fields must be completed, the method bizproc.task.list has a new property Fields (array with fields description) in PARAMETERS.

      "PARAMETERS": {
        "CommentLabel": "Comment",
        "CommentRequired": "N",
        "ShowComment": "Y",
        "StatusOkLabel": "Save",
        "Fields": [
          {
            "Type": "datetime",
            "Name": "date",
            "Description": "",
            "Multiple": false,
            "Required": true,
            "Options": null,
            "Settings": null,
            "Default": "2020-07-08T15:16:12+02:00",
            "Id": "date"
          }
        ]
      }

Default values are stored in the Default section. Values are converted to external view (for dates - to REST format ATOM (ISO-8601), and files are converted to a file link).

Next, values for these fields must be passed to the method bizrpoc.task.complete in the Fields parameter. This time, values are converted to internal view (i. e. dates are converted from REST format to an internal format, and files from REST are saved and attached to a workflow).



© «Bitrix24», 2001-2024