Documentation

bizproc.task.list

bizproc.task.list returns list of workflow tasks. Not only administrators can access this method. Usual user can request his/her own tasks or tasks of his/her subordinate. To request personal tasks, non-administrator should not specify filter for USER_ID.

Parameter Description Value by default
SELECT

Array of record fields, which can be returned by the method. Only the needed fields can be specified. Available fields:

ID - task ID;

WORKFLOW_ID - workflow ID;

DOCUMENT_NAME - document name;

DESCRIPTION - task description;

NAME - task name;

MODIFIED - date of modificaiton;

WORKFLOW_STARTED - date of workflow launch;

WORKFLOW_STARTED_BY - who launched the workflow;

OVERDUE_DATE - deadline;

WORKFLOW_TEMPLATE_ID - workflow template ID;

WORKFLOW_TEMPLATE_NAME - workflow template name;

WORKFLOW_STATE - workflow status;

STATUS - task status:

  • 0 - in progress;
  • 1 - approved (Yes response);
  • 2 - rejected (Noresponse);
  • 3 - completed (Ok response);
  • 4 - time-out (task completion time has expired).

USER_ID - user ID;

USER_STATUS - User response:

  • 0 - waiting for response;
  • 1 - yes (approved);
  • 2 - no (rejected);
  • 3 - ok (completed).

MODULE_ID - module ID (for document);

ENTITY - entity ID (for document);

DOCUMENT_ID - document ID.

ACTIVITY - task type ID, string, value options:

  • ApproveActivity - Document approval
  • ReviewActivity - Document review
  • RequestInformationActivity - Additional data request
  • RequestInformationOptionalActivity - Additional data request (with rejection)

PARAMETERS - task parameters, array, which can contain the following information:

  • CommentLabelMessage - "Comment" field name;
  • CommentRequired - defines if comment is required. Accessible values: N (no), Y (yes), YA (yes, during confirmation), YR (yes, during rejection);
  • ShowComment - Show comment, Y/N;
  • TaskButtonMessage - "Reviewed" button text;
  • TaskButton1Message - "Approve" button text;
  • TaskButton2Message - "Reject" button text;

['ID', 'WORKFLOW_ID', 'DOCUMENT_NAME', 'NAME']

Important: 'MODULE', 'ENTITY', 'DOCUMENT_ID', 'DOCUMENT_URL' - are always returned.

FILTER

Array type {"filtered_field": "filter value" [, ...]}. List of filtered fields is the same as for the SELECT parameter.

Type of filtration can be specified in front of filtered field:

  • "!" - not equal;
  • "<" - less;
  • "<=" - less or equal;
  • ">" - more;
  • ">=" - more or equal.

If USER_ID is present in the filter, user subordination is checked. Manager can request list of tasks for his/her subordinates. Administrator can request all tasks without limitations.

ORDER

Array for results sorting. Array type {"sorting_field": 'sorting direction' [, ...]}. List of field for sorting is the same as for the SELECT parameter.

Sorting direction can have the following values:

  • asc - by ascension;
  • desc - by descension.

{'ID': 'desc'}

Example

BX24.callMethod(
   'bizproc.task.list',
   {
      select: [
         'ID',
         'WORKFLOW_ID',
         'DOCUMENT_NAME',
         'DESCRIPTION',
         'NAME',
         'MODIFIED',
         'WORKFLOW_STARTED',
         'WORKFLOW_STARTED_BY',
         'OVERDUE_DATE',
         'WORKFLOW_TEMPLATE_ID',
         'WORKFLOW_TEMPLATE_NAME',
         'WORKFLOW_STATE',
         'STATUS',
         'USER_ID',
         'USER_STATUS',
         'MODULE_ID',
         'ENTITY',
         'DOCUMENT_ID'
      ],
      order: {ID: 'DESC'},
      filter: {'USER_ID': 1}
   },
   function(result)
   {
      if(result.error())
         alert("Error: " + result.error());
      else
         console.log(result.data());
   }
);

© «Bitrix24», 2001-2024